Somebody...i need some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nojhere
Forum Newbie
Posts: 1
Joined: Sun Nov 01, 2009 8:30 pm

Somebody...i need some help

Post 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.....
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Somebody...i need some help

Post by requinix »

Look at your query. Just, look at it. If you look hard enough you'll see the problem.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Somebody...i need some help

Post 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.
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: Somebody...i need some help

Post by Mirge »

You're also missing a closing parentheses..
Post Reply