Php DATEDIFF不存在
这是我的问题Php DATEDIFF不存在,php,mysql,datediff,Php,Mysql,Datediff,这是我的问题 $sql= "select count(event_id) as cnd from wp_em_events where DATEDIFF (event_end_date, CURDATE()) > 0 and event_status= 1"; $result= mysql_query($sql); $row= mysql_fetch_assoc($result); return $row['cnd']; 这在localhost中正常工作,但在服务器中不正常,并返回
$sql= "select count(event_id) as cnd from wp_em_events where DATEDIFF (event_end_date, CURDATE()) > 0 and event_status= 1";
$result= mysql_query($sql);
$row= mysql_fetch_assoc($result);
return $row['cnd'];
这在localhost中正常工作,但在服务器中不正常,并返回此错误1305-函数DATEDIFF不存在尝试将DATEDIFF放在括号中,如下所示:
$sql= "select count(event_id) as cnd from wp_em_events where
(DATEDIFF (event_end_date, CURDATE())) > 0 and event_status= 1";
我认为phpMyAdmin中也存在一个bug,这意味着您必须对终端进行限制才能使其正常工作,因此也可以尝试以下方法:
$sql= "select count(event_id) as cnd from wp_em_events where
(DATEDIFF (event_end_date, CURDATE())) > 0 and event_status= 1 LIMIT 0,10";