Jump to content

[SOLVED] Syntax Error when forcing the error with mysql_error()


cpd

Recommended Posts

Ive got a line of SQL that will input a row into my table and the information is correct as far as im away. Ive re-written the line a few times and the same error occurs saying

 

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 'key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,' at line 1

 

The line that involves "'key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,' " is:

 

    mysql_query("INSERT INTO `users` (joined,key,pilotid,name,email,country,dob,password,simulator,hub,vatsimid,ivaoid,hours,proof,comments,code,activated) VALUES ('$date','n','$pilotid','$name','$email','$country','$dob','$password','$simulator','$hub','$vatsimid','$ivaoid','$hours','$proof','$comments','$code','n')")or die(mysql_error());

 

At least thats what im led to believe however i cant undersatnd why it refers to line 1.

 

What does the error mean and how do i correct it?

The part of the query that is displayed in the error message immediately after the ' in - right syntax to use near 'xxxxxxxx is the point where mysql could not figure out what you were trying to do. A sql syntax error means you put some language element where it does not belong. In your case 'key' is a reserved word and should not be used as a column name - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

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.