mysql select count(filed) 问题(where条件没有数据匹配的话也有数据返回)。
2014-07-24 18:55 youxin 阅读(653) 评论(0) 收藏 举报问题:
SELECT count(*),user_id FROM tb_rp_logintrace
WHERE
id=-1
返回结果:
count(*), user_id
0 null
php接受到:
Array
(
[0] => Array
(
[count] => 0
[loading_back] =>
)
)
如果不用count,改成:
$sql="select * from tb_rp_logintrace
WHERE
id=-1";
Array
(
)
用count判断是否为空。
浙公网安备 33010602011771号