I am stucked with a situation where i have to list all the tables from the database given. Then the user can select any table to export or the full database.

I used show all tables.

```
$query = "SHOW TABLES FROM $DBNAME";
$sql = mysql_query($query);
$tables = array();
while($sql1 = mysql_fetch_array($sql))
{
  $name = $sql[0];
  $tables[] = $name;
}
echo '<pre>';
print_r($tables);
echo '</pre>';
exit;

```

But the array is with no name but having the same number of elements as the number of tables.

Any help.