Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.