Try: <? mysql_connect("localhost", "user", "password"); $query = "SHOW TABLES;"; $result = mysql_db_query("databasename", $query); $i = 0; while ($row = mysql_fetch_array($result)) { $tableNames[$i] = $row[0]; $i++; } for ($i = 0; $i <= count($tableNames); $i++) { $query = "SELECT COUNT(*) FROM " . $tableNames[$i] . ";"; $result = mysql_db_query("databasename", $query); $row = mysql_fetch_array($result); echo "Table " . $tableNames[$i] . " contains " . $row[0] . " rows.\n<br>"; } ?>
Doug -----Original Message----- From: andy thomas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 11:23 PM To: [EMAIL PROTECTED] Subject: Table statistics Is there a command I can give in the mysql client to find the number of rows in a table or, better still, the number of rows in all the tables in a database? Andy --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php