trq Posted January 7, 2007 Share Posted January 7, 2007 Ok, its hard to see the errror, we need to print your sql statement. Change what I just gave you to include....[code=php:0]mysqli_error($DB_Server)."SQL= ".$New_Player_SQL[/code] Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 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 ''User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') ' at line 2SQL= INSERT INTO General_Stats ('User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') VALUES ('*****', '*****', '*****', '*****', '*****', '*****')ive blanked out the actual details, but i checked them, and therye all correctly passed to the page etc..... Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 You're passing 6 vars into 7 fields? Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 ok, thats actually an error on my behalf when i blanked out the actual details, sorry, if you want me to ad in another ***** then i will but i dont see any point Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 We need to see your actual data. The way it is, there is nothing wrong with your query, so your data must be dojng something.If we can't see your data for sdecurity reasons your going to be on your own, but my first suggestion would be to escape any quotes. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 ok i redid the new player entry, using the field name as the actual input ( or as close as i could get) and i still got the error. heres the output, after my personal message ( ie this is generated by php)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 ''User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') ' at line 2SQL= INSERT INTO General_Stats ('User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') VALUES ('User_Name', 'Password', 'email@localhost.com', '9069 - 207 - 876', 'FName', 'LName', '30 - 50') Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 What field types are Security_number and Age? Quote Link to comment Share on other sites More sharing options...
marcus Posted January 7, 2007 Share Posted January 7, 2007 [code=php:0]$sql = "INSERT INTO `General_Stats` (`User_Name`,`Password`,`Email`,`Security_Number`,`F_Name`,`L_Name`,`Age`) VALUES ('username','password','email','s_number','fname','lname','age')";[/code]NOTE: If the field is an integer you can only insert numerals, meaning no dashes, spaces, etc.. and make sure the field lengths are greater than what you're trying to insert. Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 After all that, and I didn't even see it. You dont need (can't have) quotes around your field names.[code=php:0]"INSERT INTO General_Stats (User_Name,`Password`,Email,Security_Number,F_Name,L_Name,Age) VALUES ('username','password','email','s_number','fname','lname','age')"[/code]Password needs backticks because it is a reserved word. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 haha good catch thorpe. He's right, you'd use `` around a field name, not ''.Mgall was actually right ;) Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 ok, thanks age is text BUT the security number ( all of this is the format in the database) is of an integar format, so ill change it and let you know what happensas using the single quotes instead of double quotes, i dont understand??? Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 [quote]haha good catch thorpe. He's right, you'd use `` around a field name, not ''.[/quote]Its a bad habbit to use ` when you dont need to. It was the quotes throwing me off, thinking thery where backticks. If less people used backticks around everything we wouldn't have such problems. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 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 ''User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') ' at line 2SQL= INSERT INTO General_Stats ('User_Name', 'Password', 'Email', 'Security_Number', 'F_Name', 'L_Name', 'Age') VALUES ('User_Name', 'Password', 'email@localhost.com', '3975 - 539 - 388', 'FName', 'LName', '30 - 50') Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 [quote]as using the single quotes instead of double quotes, i dont understand???[/quote]There is no single quotes / double quote issue. The issue is, you cannot put quotes around your field names. However, you must use backticks ( ` ) around reserved words.See my example. Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Read the replies! Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 ok, thanks ill try changing it now Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 , thanks every one for all your help.deleting those quotes and changing to baticks or whaterver worked like a charm......... ;D ;D ;D ;D ;D ;D ;D ;Dthanks everyone Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 7, 2007 Share Posted January 7, 2007 thorpe - I rarely put them there, but I've forgotten to use them around reserved words before, and fussed over it long enough to make me swear. ;) Quote Link to comment 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.