SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Threaded View
-
Nov 24, 2004, 09:27 #1
- Join Date
- Nov 2002
- Location
- Madison, WI USA
- Posts
- 448
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
list table names and row counts in a database
Hi,
I am trying to list all the tables with their row counts in a databse... I have been racking my brain on how to do this. So far I have figured out that there is a function mysql_list_tables(), however, this is depreciated and should not be used. So this is my code so far, but I have no idea on how to include my while statments to output a list like so
Code:TABLE NAME COUNT table1 1204 table2 1053 table3 5042
PHP Code:<?php
include ("config.php");
if (!mysql_connect('$host', '$user', '$pass')) {
** echo 'Could not connect to mysql' . mysql_error;
** exit;
}
$result=mysql_query('SHOW TABLES FROM $db') or die(mysql_error);
?>
Bookmarks