Faqts : Computers : Programming : Languages : 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?

11 of 26 people (42%) answered Yes
Recently 4 of 10 people (40%) 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