Hello, I recieve XML error: "Only one top level element is allowed in an XML document." when I try to run my sitemap script in PHP:
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM pages_content WHERE date < CURRENT_TIMESTAMP"));
$result = mysql_query("SELECT * FROM pages_content WHERE date < CURRENT_TIMESTAMP ORDER BY id DESC")...
I have a problem with inserting a letter that is not an A-Z char.
For example:
$fullTag = 'świat';
A 'letter' should contains ś
$data = array(
'full_tag' => $fullTag,
'count' => 1,
'letter' => $fullTag[0],
);
But when I execute $table->insert($data);, it inserts me as letter an empty string.
If I set instead of ...
When I create a category in my CMS, I want to create its directory/folder in an image directory.
Can I create a directory or folder with php?
Can anyone tell me how please?
...
PHP PDO's lastInsertId() method actually returns an numeric value, but it may also return something completely different like some strange SQLSTATE code or whatever. In any case it returns not a numeric value I would like to log an error. Is there a way to safely check for that?
...
Just a few days ago I found out about this miracle called CakePHP so I am pretty green to it.
I need to build a mail application, so I have followed the convention and created:
Database description:
Table of users <user_id (primary key), fname, lname>.
Table of mails <mail_id(primary key), from (foreign key to user_id), to (foreign ...
Hi Gurus,
I have a time tracking sheet application. In this I will display dates in a week on X axis (on top) and Tasks on Y-axis (downwards). As shown below, I will give a @ icon after every text box for entering comments against each entry.
****************************************************
# | Sun | Mon | Tue | Wed | Thu | ...
I have a defined route that displays a dynamic page:
page_show:
url: /:domain_slug/:slug
class: sfPropelRoute
options:
model: Page
type: object
method: doSelectByDomain
param: { module: page, action: show }
requirements:
sf_method: [get]
This works great, but now I want my homepage URI to route to a spec...
I have a question about preg_replace() function. I'm using it with 'e' modifier. Here is code snippet:
$batchId = 2345;
$code = preg_replace("/[A-Za-z]{2,4}[\d\_]{1,5}[\.YRCc]{0,4}[\#\&\@\^]{0,2}/e",
'translate_indicator(\'$0\', {$batchId})', $code);
I want to have access to $batchId variable inside translate_indi...
EDIT: Kohana 2.3.4
Is the proper way to make a few variables available to all my controllers to add a MY_Controller.php file in my /application/libraries/ folder (shown in the docs here)?
Are there any better ways to do it, or is this the only recommended method?
Being new to OOP, can you link me to any examples?
EDIT 2:
I've heard ...
Here's the problem: When a script starts modifying the database and something goes wrong, the database is usually corrupted. For example, lets say we have a User table and a Photos table.
A script creates a user dataset and in the next lines it attempts to create a photo dataset. The photo has a user_id column. Now lets assume somethin...
My php script should validiate address of websites, that user type into the form.
Adress should look like this:
http://example.com/example/{some numbers}/
or
http://example.com/example/{some numbers}
And I have think about something like this, but it doesn't work:
/^(http:\/\/)?example\.com\/example\/\d{1}(\/?)$/
Can you show me wh...
hi,
I am trying to connect remote mysql i am having typical issue.
$conn = mysql_connect('xxx.xxx.xxx.xxx', 'username', 'password') or die(mysql_error());
Let my system host name is my.host.com and remote one is remote.host.com
I tryed using both IP xxx.xxx.xxx.xxx and remote.host.com it is saying that
Access denied for user 'usern...
Hey guys,
I have got a little problem using the CodeIgniter route function.
I use the URI_Language_Identifier extension and I want to reroute all
the requests for "lang/login" (e.g. en/login or de/login) to user/login I tried to use the routes function as follows, but it does not work:
$route['(\w{2})/login'] = "/user/index";
this ho...
Hi
I have these tables:
forum
id
name
description
posts
id
forumID
body
What I wonder is should I create a field in forum where i store the number of posts that been made in that forum? Update it every time someone makes a post. or should I count them with php? Is it a huge performance difference?
...
i have to objects / elements. one is [ 4 images with different ids ] and [ a div with id container ]....
i want to make images dragable and alert the id of image if it is dragged and dropped properly inside container div.......
and then send its value to mysql with php and jquery $.ajax
...
Example: I use a PDO method that throws an exception. But inside the try block, I also throw an own Exception if something else goes wrong. Now I want to handle the PDOException and my own Exception separately. How could I separate this to make it work?
public function prepare(string $sql, array $params) {
try {
$prepared...
I am new to PHP. I have a PHP array that is two dimensional. The "inner" array has a value that I want to sort on.
For example:
$myarray[1]['mycount']=12
$myarray[2]['mycount']=13
$myarray[3]['mycount']=9
I want to sort the "inner" array in descending order.
So the results for the following will be 13, 12, 9
foreach ($myarray as ...
I've looked through the Related Questions section and I can't find an answer to this. I'm using PHP + Jquery. I added <input type='file' name='file[]' size='20 />' dynamically, using Jquery. However, when I Post the data, and use print_r($_POST);, I get the other elements that were there before I dynamically added the Jquery Code, but no...
I have PHP installed on ARM91. It works fine until I use session_start. Then I get the following
Warning: session_start(): read returned less bytes than requested
This does not seem to be a permission problem - the sess_* files are created. When you try to put anything into such session, it creates sparse file (17GB size) for the session...
Due to a bug in my servers PDO version, I have switched to using MySQLi. However, this presents another problem, as the Zend_DB MySQLi adaptor doesn't have an exec function. (The Zend PDO adaptor did), which means I can't execute a sql script. (Containing a load of DROP TABLE and CREATE TABLE queries).
So where I could just do:
$sqlQue...