这是我到目前为止所拥有的:
$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
}
但我收到此错误:
Warning: mysql_num_rows() expects parameter 1 to be resource,
boolean given in...
任何帮助将不胜感激!
在这部分之前一切正常:
(startdate<$today AND enddate>$daytime) OR (startdate=$today AND starttime<=$currenttime AND enddate>$daytime) limit 1");
我已经检查过,它正在检查表中的正确行,并且我在查询之前定义了 $today、$daytime 和 $currenttime:
$today=date("Y-m-d");
$currenttime=date("H:i:s");
$daytime=date("Y-m-d H:i:s");