note 111516 added to function.mysql-list-tables
| From: | bimal at sanjaal dot com | Date: | Thu, 28 Feb 2013 09:22:23 +0000 |
| Subject: | note 111516 added to function.mysql-list-tables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193745@lists.php.net to get a copy of this message | ||
A better alternative to mysql_list_tables() would be the following mysql_tables() function.
<?php
/**
* Better alternative to mysql_list_tables (deprecated)
*/
function mysql_tables($database='')
{
$tables = array();
$list_tables_sql = "SHOW TABLES FROM {$database};";
$result = mysql_query($list_tables_sql);
if($result)
while($table = mysql_fetch_row($result))
{
$tables[] = $table[0];
}
return $tables;
}
# Usage example
$tables = mysql_tables($database_local);
?>
----
Server IP: 69.147.83.199
Probable Submitter: 202.166.221.1
----
Manual Page -- http://php.net/manual/en/function.mysql-list-tables.php
Edit -- https://master.php.net/note/edit/111516
Del: integrated -- https://master.php.net/note/delete/111516/integrated
Del: useless -- https://master.php.net/note/delete/111516/useless
Del: bad code -- https://master.php.net/note/delete/111516/bad+code
Del: spam -- https://master.php.net/note/delete/111516/spam
Del: non-english -- https://master.php.net/note/delete/111516/non-english
Del: in docs -- https://master.php.net/note/delete/111516/in+docs
Del: other reasons-- https://master.php.net/note/delete/111516
Reject -- https://master.php.net/note/reject/111516
Search -- https://master.php.net/manage/user-notes.php