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 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 `` 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! Link to comment https://forums.phpfreaks.com/topic/249294-mysql-insert/#findComment-1280102 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.