mysql_list_tables

(PHP 3, PHP 4 >= 4.0.0)

mysql_list_tables -- List tables in a MySQL database

Description

resource mysql_list_tables ( string database [, resource link_identifier])

mysql_list_tables() takes a database name and returns a result pointer much like the mysql_query() function. You can use the mysql_tablename() function to extract the actual table names from the result pointer, or any other result table function.

For downward compatibility mysql_listtables() can also be used. This is deprecated however.

Example 1. mysql_list_tables Example

<?php
    mysql_connect("localhost", "mysql_user", "mysql_password") or
        die("could not connect");
    mysql_select_db("mydb");

    $result = mysql_list_tables();

    while (($row = mysql_fetch_row($result))
        printf ("Table: %s\n", $row[0]);  

    mysql_free_result($result);
?>

See also: mysql_list_dbs(), mysql_tablename().