Page 1 of 1

Somebody...i need some help

Posted: Sun Nov 01, 2009 8:38 pm
by nojhere
This is my code..

$sql = "INSERT INTO template (file,file_ext, file_size, file_data,tarikh_kemaskini) ";
$sql.= "VALUES (";
$sql.= "'{$file}', '{$file_ext}', '{$file_size}', '{$file_data}','{CURDATE()}' WHERE id='$id'";


Error occur said like this :

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='1'' at line 1

The error maybe at WHERE id='$id'"; syntax and how to overcome this problem??
Help me.....

Re: Somebody...i need some help

Posted: Sun Nov 01, 2009 10:55 pm
by requinix
Look at your query. Just, look at it. If you look hard enough you'll see the problem.

Re: Somebody...i need some help

Posted: Sun Nov 01, 2009 11:11 pm
by califdon
I feel sorry for a first-time poster, so I'll point out that it doesn't make any sense to have a WHERE clause in an INSERT query.

Re: Somebody...i need some help

Posted: Mon Nov 02, 2009 9:42 am
by Mirge
You're also missing a closing parentheses..