In mysql, The mysql_list_tables usage syntax is used to display all tables,
In the mysql tutorial, all tables will be displayed.Mysql_list_tables usage syntaxTo operate,
Mysql_list_tables syntax
Resource
Mysql_list_tables(String $ Database[, Resource $ Link_identifier])
Look at a simple instance
<? Php tutorial
$ Dbname = 'mysql _ dbname ';
If (! Mysql_connect ('mysql _ host', 'mysql _ user', 'mysql _ password ')){
Echo 'could not connect to mysql ';
Exit;
}
$ SQL = "SHOW TABLES FROM $ dbname ";
$ Result = mysql_query ($ SQL );
If (! $ Result ){
Echo "DB Error, cocould not list tablesn ";
Echo 'mysql Error: '. mysql_error ();
Exit;
}
While ($ row = mysql_fetch_row ($ result )){
Echo "Table: {$ row [0]} n ";
}
Mysql_free_result ($ result );
?>
It is just a simple description:
The mysql List table changes in your active database tutorial.
For example:
<? Php
// Set databse context to db1
Mysql_select_db ("db1 ");
// List database tables from db2
Mysql-list-tables ("db2 ");
?>
<?
Mysql_connect ("localhost", "login", "passwd") or
Die ("Cannot connect:". mysql_error ());
Mysql_select_db ("db_name ");
$ Res = mysql_query ("show table status like 'table _ name'") or die (mysql_error ());
$ Row_res = mysql_fetch_array ($ res );
Echo $ row_res [Auto_increment];
?>