This is my PHP code snippet:
$conn = mysqli_connect($servername, $dbusername, $dbupassword, $dbname);
$sql = "SELECT COUNT(*) FROM `users`;";
$count = $conn->query($sql);
echo $count->num_rows;
It always echos 1 even though I have 5 users in my table (see image below). 
I also tried using COUNT(1) but it also returned 1. But when I change the statement to SELECT * FROM `users`; it returns 5.
If I do a var_dump($count) (same code as above but I don't use the num_rows), I get the information below:
object(mysqli_result)#2 (5) {
["current_field"]=> int(0)
["field_count"]=> int(1)
["lengths"]=> NULL
["num_rows"]=> int(1)
["type"]=> int(0)
}
I am running phpMyAdmin, Version information: 5.0.2, with database version: 10.4.14-MariaDB, and PHP 7.4.10
1because when you execute the querycount()you'll get one row. what you have to do is fetch the row, to get to the yielded value ofcount()which is5count()showed you. just testing it in phpmyadmin should show 1 row.COUNT(*)then under that5. that's where you need fetch to