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());

order is a reserved word, use backticks.

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

Member Avatar

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)