0

i got this error when i trying to submit a form..

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 'order(firstname,lastname,email,address,city,postalcode,country,totalprice,paymen' at line 1

appreciate if you could assist me..

$sql2= mysql_query("INSERT INTO order(firstname,lastname,email,address,city,postalcode,country,totalprice,payment,status) VALUES( '$_POST[firstname]', '$_POST[lastname]', '$_POST[email]', '$_POST[address]', '$_POST[city]', '$_POST[postalcode]',  '$_POST[country]', '0', '$_POST[payment]', 'Successful')")or die(mysql_error());
3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0

order is a reserved word, use backticks.

thanks.

i changed my table name to user_order earlier

and i got this error n couldnt find 1,5
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 '1', '5')' at line 1

0

If you're using raw post data - NOT recommended - you need to use braces:

'$_POST[firstname]'

should be:

'{$_POST['firstname']}'

(and for all of them)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.