cpd Posted November 2, 2008 Share Posted November 2, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/131086-solved-syntax-error-when-forcing-the-error-with-mysql_error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 2, 2008 Share Posted November 2, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/131086-solved-syntax-error-when-forcing-the-error-with-mysql_error/#findComment-680603 Share on other sites More sharing options...
cpd Posted November 2, 2008 Author Share Posted November 2, 2008 Cheers dude, i just spent ages takeing each part out of the auery and testing it seperately and i found out exactly what youve just described, thankyou Quote Link to comment https://forums.phpfreaks.com/topic/131086-solved-syntax-error-when-forcing-the-error-with-mysql_error/#findComment-680616 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.