Author Topic: MYSQL_LIST_TABLES( )  (Read 681 times)

Offline chinmay.sahooTopic starter

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 158
  • Karma: 0
    • We Helpline
« on: 05-25-2016, 03:22:00 »
If given a database name this function will return a result identifier to a list of tables within a database

int mysql_list_tables (string database [, int link_identifier])

Like mysql_query(),  this  function  doesn’t  contain  the  results;  those  must  be fetched  with  the  mysql_tablename() function.  The  following  example  shows  how you might use these functions to get a listing of tables from the database named “test”

for($i=0; $i<mysql_num_rows($tables); $i++)
echo mysql_tablename($tables,$i), “<br>\n”;

If you don’t wish to commit these functions to memory, you could use the following code to achieve the same thing.

$result = mysql_query (“show tables from test”) or
die( mysql_error() );
while( $row = mysql_fetch_row($result) )
echo $row[0], “<br>\n”;