What is this INSERT error?

I’m trying to run an INSERT on a mysql table using php, heres the result

So I went to PHPmyAdmin and pasted
INSERT INTO employees VALUES (,test first name,test last name,fcd,lurtnowski@gmail.com,cb,1,Test Job Title)
into the sql query thing and get

Do you see what the problem is?

Yes, your INSERT syntax is incorrect. You are missing a VERY important (and fundamental) clue for the database to know what you want it to do… :wink:

Wonder what it could be?

hint: Look here and see what’s different from your version

1 Like

thought it was the ;, but I guess not
heres the PHP

stmt = $conn->prepare("INSERT INTO `employees` VALUES  (,:First_Name, :Last_Name, :Extension, :Email, :Office_Code, :Reports_To, :Job_Title);");	

HINT #2 - You’re missing something VERY important between employees and VALUES

1 Like

dang it, thought it was the parameters, but wrong again

$stmt = $conn->prepare("INSERT INTO `employees` (employeeNumber,firstName,lastName,extension,email,officeCode,reportsTo,jobTitle) VALUES  (,:First_Name, :Last_Name, :Extension, :Email, :Office_Code, :Reports_To, :Job_Title);");	

MUCH closer…now compare what’s in the first parenthesis and what’s in the second parenthesis. What do you notice different?

Dang, dont see a difference… There re 8 parameters in both, right? Isnt the (, …) equal to 8? 7 to the right of the , and 1 to the left as the one on the left is an autonumber so is that ok?

Hmmmm…I wonder? :wink:

Hint: http://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html

oh man, my bad (i was never sure)
Good to know…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.