Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
impulse()
Forum Regular
Posts: 748 Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:
Post
by impulse() » Mon Sep 11, 2006 5:59 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Sep 11, 2006 6:03 pm
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() » Mon Sep 11, 2006 6:07 pm
I realise it's the MySQL statement (line 10) but I can't see what's wrong with it.
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Mon Sep 11, 2006 6:10 pm
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)
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Sep 12, 2006 3:03 am
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).