Here is what I have so far:
$checkbonus = mysql_query("Select theurl from `vaultpromo` where (accid=0 or accid=$acctype) and (shownum=$clickstoday or (showtype=1 and ($clickstoday%shownum=0))) AND
(startdate<$today AND enddate>$daytime) OR (startdate=$today AND starttime<=$currenttime AND enddate>$daytime) limit 1");
if (mysql_num_rows($checkbonus) > 0) {
DO SOMETHING
}
But I am getting this error:
Warning: mysql_num_rows() expects parameter 1 to be resource,
boolean given in...
Any help would be greatly appreciated!
Everything works until this part:
(startdate<$today AND enddate>$daytime) OR (startdate=$today AND starttime<=$currenttime AND enddate>$daytime) limit 1");
I have checked and it is checking for correct rows in the table and I have defined $today,$daytime, and $currenttime just prior to the query with this:
$today=date("Y-m-d");
$currenttime=date("H:i:s");
$daytime=date("Y-m-d H:i:s");