ballouta Posted April 10, 2008 Share Posted April 10, 2008 Hello kindly I need some help How can I get: 1) number of tables created in a specific Database 2) their names thank you Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/ Share on other sites More sharing options...
trq Posted April 10, 2008 Share Posted April 10, 2008 Take a look at mysql_list_tables(). Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/#findComment-513805 Share on other sites More sharing options...
obsidian Posted April 10, 2008 Share Posted April 10, 2008 Take a look at mysql_list_tables(). FYI, as the manual suggests, the function is deprecated, but you can still run a mysql_query() function call: SHOW TABLES FROM db_name Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/#findComment-513815 Share on other sites More sharing options...
ballouta Posted April 10, 2008 Author Share Posted April 10, 2008 Hi the SHOW TABLES FROM db_name is working how do i loop and print the tables names? thank you Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/#findComment-513910 Share on other sites More sharing options...
obsidian Posted April 10, 2008 Share Posted April 10, 2008 Hi the SHOW TABLES FROM db_name is working how do i loop and print the tables names? thank you You actually don't need the "FROM" clause, since you would have already selected a DB to use. Try this: <?php $sql = mysql_query("SHOW TABLES"); while ($row = mysql_fetch_row($sql)) { echo $row[0] . "<br />\n"; } ?> Hope that helps. Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/#findComment-513924 Share on other sites More sharing options...
ballouta Posted April 10, 2008 Author Share Posted April 10, 2008 Thanks alot Link to comment https://forums.phpfreaks.com/topic/100474-solved-number-of-tables-in-a-db/#findComment-513925 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.