dapcigar Posted October 29, 2014 Share Posted October 29, 2014 Am trying to save into the DB. after running the query, i keep getting this error. "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 'leave, meal, gross, tax, pension, dha, hmo, loan, surcharge, corporative, sa, ov' at line 1" have tried looking for the problem but i can't find it.. here's the code below $que = mysql_query("INSERT INTO salary(id, firstname, lastname, basic, housing, transport, ultility, entertainment, leave, meal, gross, tax, pension, dha, hmo, loan, surcharge, corporative, sa, overtime, netpay, date, status) VALUES (NULL, '$firstname', '$lastname', ' $basic', '$housing', '$transport', '$ultility', '$entertainment', '$leave', '$meal', '$gross', '$tax', '$pension', '$dha', '$hmo', '$loan', '$surcharge', '$corporative', '$sa', '$overtime', '$netpay', '$date', '$status')") or die(mysql_error()); Thanks in advance Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted October 29, 2014 Solution Share Posted October 29, 2014 (edited) 'leave' is a MySQL reserved word. You need to enclose it in backticks (`leave`). NB - not single quotes. http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Edited October 29, 2014 by Barand Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.