Forum Moderators: coopster
while($row=mysql_fetch_array($res)) {
echo $row['tables']
};
include 'library/closedb.php';
?>
$query = 'show tables';
$result = mysql_query($query);
#
$tables = array();
while($row = mysql_fetch_array($result)) {
$tables[] = $row[0];
}
echo '<pre>';
print_r($tables);
echo '</pre>';
$query = 'show tables';
$result = mysql_query($query);
#
$tables = array();
while($row = mysql_fetch_array($result)) {
$tables[] = $row[0];
}
echo '<pre>';
print_r($tables);
echo '</pre>';
include 'library/closedb.php';
?>
and this is the output:
Array
(
)
$tables is an array containing the names of the tables in that database. The code I have shown you just echos the contents of the array. If you want to do something else with them, you can loop [php.net] through the array and echo accordingly.