Faqts : Computers : Programming : Shopping For You : PHP : Database Backed Sites : ODBC

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 27 people (44%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I query the names of all tables in a DB?

Jun 7th, 2000 00:29
Richard Heyes, Reinhard Lopinski, Thomas Scheider,


That depends on the database.
The following request gives you a list of all tables from a adabas
database:
$con = odbc_connect(...);
$select = "select tablename from tables"
$result = odbc_exec($con, $select);
if($result) {
   while (odbc_fetch_row($result)) {
      echo odbc_result($result,1);
   };
};
For MySQL (and possibly others too) you could use this sql query:
SHOW TABLES