我是php中的新成员,我被一个查询从表tree
中提取所有记录而不计空记录。这里是我的代码:如何在mysql中使用count函数
$query = mysqli_query($con, "SELECT COUNT('left') FROM tree WHERE userid='$eid' AND left not null");
while ($result = mysqli_fetch_array($query)) {
print_r($result);
}
但我得到这个:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
的可能的复制[mysqli的\ _fetch \ _array()/ mysqli的\ _fetch \ _assoc()/ mysqli的\ _fetch \ _row()预计参数1是资源或mysqli \ _result,布尔给定](https://stackoverflow.com/questions/2973202/mysqli-fetch-array-mysqli-fetch-assoc-mysqli-fetch-row-expects-parameter-1) – CD001