我有这个查询来检查运动是否存在并且应该返回真或假。这个查询
function movement_performed_today($class_id, $client_id){
$class_id = (int)$class_id;
$client_id = (int)$client_id;
$query = mysql_query("SELECT COUNT(`movement`) FROM `completed_movements` WHERE `class_id` = '$class_id' AND `client_id` = '$client_id' AND `date` = CURDATE()");
$movement_performed = mysql_fetch_assoc($query);
$return = (mysql_result($movement_performed, 0) == 1) ? true : false;
var_dump ($return);
}
回报:
bool(false)
bool(false)
如果我替换此代码:
$return = result(mysql_result($movement_performed, 0) == 1) ? true : false;
var_dump ($return);
有了这个:
print_r ($movement_perfomed);
回报:
Array ( [COUNT(`movement`)] => 2 )
Array ( [COUNT(`movement`)] => 3 )
我是否完全错误地认为,因为这些数字不是零,它应该返回真实?