note 106451 deleted from function.mysql-query by tularis
| From: | tularis@php.net | Date: | Fri, 11 Nov 2011 16:28:07 +0000 |
| Subject: | note 106451 deleted from function.mysql-query by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184388@lists.php.net to get a copy of this message | ||
Note Submitter: roy DOT hochstenbach AT gmail DOT com
Reason: useless
----
Here's a quick way of getting the names of the tables in the current database:
// select a database
mysql_select_db("mydatabase");
// execute the query
$tables = mysql_query("SHOW TABLES");
// Create an array to store the table names
$tablelist = array();
// Go through each result and store it in the array
while($fetchtables = mysql_fetch_array($tables)) {
$tablelist[] = $fetchtables[0];
}
// This array now contains all tables
print_r($tablelist);