I want to show the count of users which have the status 1 (see code) within PHP MySQL.
<?php // something like this $result = mysqli_query($mysqli, "SELECT COUNT(*) FROM users WHERE status = '1'"); echo "$result"; ?>
Advertisement
Answer
Try this:
$query = "SELECT COUNT(*) as countvar FROM users where status = '1'"; $result = mysqli_query($con,$query); $row = mysqli_fetch_array($result); $count= $row['countvar '];