mysql count tables in a database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gpong
Forum Newbie
Posts: 16
Joined: Sun Aug 06, 2006 8:49 am

mysql count tables in a database

Post by gpong »

hi

i was wondering if there was a mysql function that counted the number of tables in a database.

if anyone knows of such a command that would be great.

thanks
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

There's no single function that can do it, but it can be done.

Code: Select all

//Stuff to connect to database
$rsTables = mysql_query("show tables", $databaseConnection);
$intNumberOfTables = mysql_num_rows($rsTables);
Post Reply