MySQLi count(*) always returns 1

Iscmhzfhrbsuf

New Member
I'm trying to count the number of rows in a table and thought that this was the correct way to do that:\[code\]$result = $db->query("SELECT COUNT(*) FROM `table`;");$count = $result->num_rows;\[/code\]But counts always returns \[code\](int)1\[/code\]. If I use the same query in phpMyAdmin I get the right result. It sits in a table so I tried testing \[code\]$count[0]\[/code\] as well, but that returns \[code\]NULL\[/code\].What is the right way to do this?
 
Back
Top