dudejma Posted October 18, 2011 Share Posted October 18, 2011 I don't understand where the empty value is. I've substituted the variables for text and still have the same problem. Code: $sql = "INSERT INTO courses (course#, name, subject, semester, ap)VALUES('$courseNum', '$courseName', '$subject', '$semester', '$ap')"; 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 '' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/249294-mysql-insert/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 18, 2011 Share Posted October 18, 2011 Echo out the $sql variable so that you can see exactly what is in it. However, your course# column name contains a character # that is not normally permitted in a column identifier and you likely need to enclose that column name in back-ticks `` Quote Link to comment https://forums.phpfreaks.com/topic/249294-mysql-insert/#findComment-1280093 Share on other sites More sharing options...
dudejma Posted October 18, 2011 Author Share Posted October 18, 2011 It's the # mark. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/249294-mysql-insert/#findComment-1280102 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.