Eggzorcist Posted August 17, 2009 Share Posted August 17, 2009 I'm trying to enter an integer to my database but I get this error. 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 '1', '0'')' at line 3 I'm not sure why I am getting this error.. Quote Link to comment https://forums.phpfreaks.com/topic/170708-solved-sql-syntax-error-with-integers/ Share on other sites More sharing options...
Maq Posted August 17, 2009 Share Posted August 17, 2009 Show us your query. Looks like you're mixing up some quotes. Quote Link to comment https://forums.phpfreaks.com/topic/170708-solved-sql-syntax-error-with-integers/#findComment-900344 Share on other sites More sharing options...
Eggzorcist Posted August 17, 2009 Author Share Posted August 17, 2009 mysql_query("INSERT INTO events (name, fromslashes, fromdisplay, fromtime, toslashes, todisplay, totime, quickdescription, pagedescription, sameday, status) VALUES ('".$data['eventTitle']."', '".$data['from1']."', '".$data['from2']."', '".$data['fromtime']."', '".$data['to1']."', '".$data['to2']."', '".$data['totime']."', '".$data['quickDesc']."', '".$data['description'].", '".$sameday."', '".$status."')") Quote Link to comment https://forums.phpfreaks.com/topic/170708-solved-sql-syntax-error-with-integers/#findComment-900379 Share on other sites More sharing options...
Maq Posted August 17, 2009 Share Posted August 17, 2009 Missing a single quote after this value: $data['description'] A couple of side notes. - You only need single quotes if the type is not numeric. - You can use curly braces to escape associative arrays rather than concatenating all the variables. Quote Link to comment https://forums.phpfreaks.com/topic/170708-solved-sql-syntax-error-with-integers/#findComment-900386 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.