mysql_list_tables

(PHP 4, PHP 5)

mysql_list_tables锟叫筹拷 MySQL 锟斤拷锟捷匡拷锟叫的憋拷

说锟斤拷

mysql_list_tables ( string $database [, resource $link_identifier ] ) : resource

mysql_list_tables() 锟斤拷锟斤拷一锟斤拷锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷锟截猴拷 mysql_query() 锟斤拷锟斤拷锟斤拷锟斤拷锟狡碉拷一锟斤拷锟斤拷锟街革拷搿o拷锟� mysql_tablename() 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿斤拷锟街革拷耄拷锟斤拷锟斤拷魏锟绞癸拷媒锟斤拷锟斤拷暮锟斤拷锟斤拷锟斤拷锟斤拷锟� mysql_fetch_array()锟斤拷

database 锟斤拷锟斤拷锟斤拷锟斤拷要锟斤拷取锟斤拷锟斤拷锟叫的的憋拷锟斤拷锟斤拷锟斤拷锟捷匡拷锟斤拷锟斤拷锟斤拷锟绞э拷锟� mysql_list_tables() 锟斤拷锟斤拷 FALSE锟斤拷

为锟斤拷锟铰硷拷锟斤拷锟斤拷然锟斤拷锟斤拷使锟矫憋拷锟斤拷锟斤拷锟侥憋拷锟斤拷 mysql_listtables()锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

Note: 锟矫猴拷锟斤拷锟窖撅拷锟斤拷删锟斤拷锟剿o拷锟诫不要锟斤拷使锟矫该猴拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 SHOW TABLES FROM DATABASE 锟斤拷实锟街该猴拷锟斤拷锟侥癸拷锟杰★拷

Example #1 mysql_list_tables() 锟斤拷锟斤拷

<?php
    $dbname 
'mysql_dbname';

    if (!
mysql_connect('mysql_host''mysql_user''mysql_password')) {
        print 
'Could not connect to mysql';
        exit;
    }

    
$result mysql_list_tables($dbname);

    if (!
$result) {
        print 
"DB Error, could not list tables\n";
        print 
'MySQL Error: ' mysql_error();
        exit;
    }

    while (
$row mysql_fetch_row($result)) {
        print 
"Table: $row[0]\n";
    }

    
mysql_free_result($result);
?>

锟轿硷拷 mysql_list_dbs() 锟斤拷 mysql_tablename()锟斤拷