Jump to content

[SOLVED] SQL syntax error with integers


Eggzorcist

Recommended Posts

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

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."')")

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.