Qbart Posted January 28, 2007 Share Posted January 28, 2007 Hello:I have this code:[code]$sql="INSERT INTO $table_name (Email, First Name, Last Name)VALUES('$_POST[Email]','$_POST[First_Name]','$_POST[Last_Name]')";[/code]and I keep getting this error in the browser window: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 'Name, Last Name) VALUES ('testemail@yahoo.com','George','EberI'm running this on a godaddy linux account, it says under MySQL version Client API version 3.23.49 Thanks for any and all help. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 You can't have a space in a field name, First Name isn't a valid field name. (Or if I'm wrong, you need to escape it by using backticks, ie: `First Name`) Quote Link to comment Share on other sites More sharing options...
Tandem Posted January 28, 2007 Share Posted January 28, 2007 It should work with backticks around the feild names that have spaces in them. Quote Link to comment Share on other sites More sharing options...
Qbart Posted January 28, 2007 Author Share Posted January 28, 2007 Thanks jesirose,That was an unbelievably fast response by both of you! It's working now!Thanks again,Qbart 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.