svgmx5 Posted March 11, 2010 Share Posted March 11, 2010 i'm trying to add items into an sql table via a form, but every time i submit it, i get 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 ''jobID', 'jobTitle', 'startDate', 'price', ' at line 1 I've looked over the code and doubled checked the database, to make sure all the fields in the table matched what i had on the script If someone can look over the code and see if they can find anything wrong, i would gladly appreciate it $s_startDate = $_POST['startDate']; $s_price = $_POST['price']; $s_desc = $_POST['quickDesc']; $sql="INSERT INTO mail (jobID, jobTitle, startDate, price, desc) VALUES('$jobID', '$job_title', '$s_startDate', '$s_price', '$s_desc')"; $run = mysql_query($sql) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/194878-cant-insert-items-into-an-sql-table-keep-getting-error-code/ Share on other sites More sharing options...
trq Posted March 11, 2010 Share Posted March 11, 2010 desc is a reserved word. Either change your filed to a better name or escape it with `backticks`. Link to comment https://forums.phpfreaks.com/topic/194878-cant-insert-items-into-an-sql-table-keep-getting-error-code/#findComment-1024663 Share on other sites More sharing options...
svgmx5 Posted March 12, 2010 Author Share Posted March 12, 2010 Thanks that did the job, i just changed it to description and its working...didn't know that could be the issue Link to comment https://forums.phpfreaks.com/topic/194878-cant-insert-items-into-an-sql-table-keep-getting-error-code/#findComment-1025107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.