I want to get the ID of an image that is boostAmount-boostStart>total. Currently if an image exists that is appropriate it works. However, if there is nothing appropriate to show I get this error.
Invalid query: 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 'ORDER BY RAND() LIMIT 1' at line 1
$photoToGuess = mysql_query("SELECT photoID,id,total,boostStart,boostAmount,auth,photoUploadDate FROM photos WHERE (boostAmount !=0) AND ((boostAmount-boostStart)>total) AND (auth=2 OR auth=5 OR auth=7) ORDER BY RAND() LIMIT 1") or die("Invalid query: " . mysql_error());
$getphotoToGuess = mysql_fetch_array($photoToGuess);
//Yes
if(mysql_num_rows($photoToGuess) > 0)
{
//do something
}