Jump to content

MySQL Insert


dudejma

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.