02-09-2008, 02:03 AM
|
#13 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Quote:
Originally Posted by Salathe
It'll make things infinitely easier for you if your code is laid out nicely and easier to read. Also the clauses in the query should go UPDATE, SET, WHERE, LIMIT; in that order. The WHERE clause should catch only a single row (assuming you check against a primary key column) but just in case the LIMIT is there to make sure only one row is affected.
PHP Code:
mysql_query(sprintf("
UPDATE
users
SET
username = '%s',
password = '%s',
email = '%s',
access = '%s',
joindate = '%s',
WHERE
id = %d
LIMIT 1
;",
mysql_real_escape_string($username),
mysql_real_escape_string($password),
mysql_real_escape_string($email),
mysql_real_escape_string($access),
mysql_real_escape_string($date),
(int) $id
)) or die(mysql_error());
|
I'm getting this:
Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = 2 LIMIT 1' at line 9
__________________
VillageIdiot can have my babbies ;d
|
|
|
|