ayok Posted December 30, 2007 Share Posted December 30, 2007 Hi, I've been trying to insert some datas into mysql problems with this code: <?php $enter="INSERT INTO order(prod_id,quantity,subtotal) VALUES('$ses_id','$ses_quan','$subtotal')"; $input=mysql_query($enter) or die(mysql_error()); ?> But i keep getting this error msg: 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(prod_id,quantity,subtotal) VALUES('29','4','136')' at line 1 Would anybody tell me where the mistakes? Thank you ayok Link to comment https://forums.phpfreaks.com/topic/83699-solved-error-in-your-sql-syntax/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 30, 2007 Share Posted December 30, 2007 order is a reserved word - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You should change the name of the table to avoid future problems. You can enclose it in back-ticks `order` but that is a mysql specific usage and won't work if you ever move your code to a different sql database or msyql changes to more closely follow standards in the future. Link to comment https://forums.phpfreaks.com/topic/83699-solved-error-in-your-sql-syntax/#findComment-425855 Share on other sites More sharing options...
ayok Posted December 30, 2007 Author Share Posted December 30, 2007 Very Cool! Thanks, ayok Link to comment https://forums.phpfreaks.com/topic/83699-solved-error-in-your-sql-syntax/#findComment-425869 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.