$query = mysql_query("SELECT COUNT(*) FROM table")or die(mysql_error()); list($rows) = mysql_fetch_row($query); echo $rows;