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.. 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. 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."')") 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. 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
Archived
This topic is now archived and is closed to further replies.