猿问

计算特定记录的MySQL

我想显示在PHP MySQL中状态为1(参见代码)的用户数。


<?php

// something like this

$result = mysqli_query($mysqli, "SELECT COUNT(*) FROM users WHERE status = '1'");

echo "$result";

?>


萧十郎
浏览 174回答 1
1回答

三国纷争

尝试这个:$query = "SELECT COUNT(*) as countvar FROM users where status = '1'";$result = mysqli_query($con,$query);$row = mysqli_fetch_array($result);$count= $row['countvar '];
随时随地看视频慕课网APP
我要回答