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 ('[email protected]','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. Link to comment https://forums.phpfreaks.com/topic/36106-solved-help-with-php-and-mysql/ 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`) Link to comment https://forums.phpfreaks.com/topic/36106-solved-help-with-php-and-mysql/#findComment-171393 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. Link to comment https://forums.phpfreaks.com/topic/36106-solved-help-with-php-and-mysql/#findComment-171398 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 Link to comment https://forums.phpfreaks.com/topic/36106-solved-help-with-php-and-mysql/#findComment-171408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.