How to list all tables in a mysql database using php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php $linkfirst = mysql_connect('localhost', 'root', ''); if (!$linkfirst) { die('Could not connect: ' . mysql_error()); } mysql_select_db('hello', $linkfirst) or die('Could not select database.'); $dbname="hello"; $result = mysql_list_tables($dbname) or die(mysql_error()); while ($row = mysql_fetch_row($result)) { echo $row[0]; } ?> |