Jump to content

syntax error


blue-genie

Recommended Posts

no resultsYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

 

$result = mysql_query("select count(*) as count FROM gamedetails WHERE gameID <> $editGameID AND startDate<=Date($newStartDate) AND endDate>=DATE($newStartDate) OR startDate<=DATE($newEndDate) AND endDate>=DATE($newEndDate)");

 

Link to comment
https://forums.phpfreaks.com/topic/201622-syntax-error/
Share on other sites

That error is indicative of a numeric value that is empty. I recommend forming your query in a variable ($query) so that you can echo the actual query so that you can see what is wrong with it.

 

It's likely that $editGameID is empty (you should be validating all data being put into any query.)

 

You will also have problems with the DATE() functions in the query because mysql expects strings as the parameter in the DATE() function call. You must have single-quotes around the parameter if you are supplying literal values in the query.

Link to comment
https://forums.phpfreaks.com/topic/201622-syntax-error/#findComment-1057688
Share on other sites

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.