$q="select * from location where community='Zoo' AND status='1'";
$res=mysqli_query($con,$q);
echo mysqli_num_rows($res);
<?php
$con = mysqli_connect("localhost","root","","test");
if (!$con)
{
die('Could not connect: ' . mysqli_error());
}
$result = mysqli_query("select COUNT(*) FROM table");
$row = mysqli_fetch_array($result);
$total = $row[0];
echo "Total rows: " . $total;
mysqli_close($con);
?>
$count_query = "select count(*) from users";
counting rows