Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.