SELECT count(*) FROM table, show invalid results
Posted: Wed May 19, 2004 10:56 am
Hi!
Well Here is my code, to check how much records are in database
The result I get is 1. When I open MySQL Monitor and type: SELECT count(*) FROM users; I get this:
Well Here is my code, to check how much records are in database
Code: Select all
<?php
mysql_connect("localhost","user","password");
mysql_select_db("data");
$query_count = "SELECT count(*) FROM users";
$result_count = mysql_query($query_count);
$totalrows = mysql_num_rows($result_count);
echo $totalrows;
?>The result is 11. When I type there SELECT username FROM users; I get all 11 usernames, but why does my code displays that there are only one record? Thank you!+----------+
| count(*) |
+----------+
| 11
+----------+
1 row in set (0.01 sec)