How do you count all of the rows in a given table, then display the number?
$resid = mysql_query(' SELECT COUNT(*) AS c FROM tbl_name '); $res = mysql_fetch_assoc($resid); echo $res['c'];
or you could use
$query = "SELECT column FROM table"; $result = mysql_query($query); $rows = mysql_num_rows($result)
for all the rows you'd use this
$result = mysql_query("SELECT * FROM table"); $num = mysql_numrows($result); print $num;
and yes mysql_numrows does work.
Originally posted by chuckury and yes mysql_numrows does work.
But why would you want to use it, as it has been depreciated?
Also, the code you posted will not work, as you never ran a mysql_query().
lol, I need more sleep.
chuckury, mysql_numrows() is deprecated. use mysql_num_rows() instead.