Would somebody look at this simple MySQL statement please?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Would somebody look at this simple MySQL statement please?

Post by impulse() »

I'm just getting into inserting data on a MySQL server from a PHP script and I can't see what's wrong with this update statement. Would someone mind pointing me in the right direction?

Code: Select all

include_once("/var/www/html/php/db/logon.php");

mysql_connect($host, $user, $pass);
mysql_select_db($db);

$query = mysql_query("UPDATE * SET timeAdded='Null' WHERE timeAdded=''") or die("I'm back" .mysql_error());
echo "<br>Update sucess";
Running the script returns
PHP Parse error: syntax error, unexpected T_STRING in /var/www/html/php/db/edit.php on line 10
Regards, Stephen
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The error says line 10, so the error is either there or on line 9 or whatever line is the previous statement.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post by impulse() »

I realise it's the MySQL statement (line 10) but I can't see what's wrong with it.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

impulse() wrote:I realise it's the MySQL statement (line 10) but I can't see what's wrong with it.
well we didn't because the SQL query is on line 6 (to us)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

And if I take the code snippet and have it tested by php -l, there's no syntax error. Your error is caused somewhere else (before that snippet).
Post Reply