How do I get the MySQL table structure in PHP? Plus a list of all tables?
To get a list of columns for a table, use the DESCRIBE SQL statement. The syntax is as follows:
DESCRIBE TableName
To get a list of tables on the database, use this SQL statement:
SHOW TABLES
$q = mysql_query('DESCRIBE tablename');
while($row = mysql_fetch_array($q)) {
echo "{$row['Field']} - {$row['Type']}\n";
}
found it at http://www.electrictoolbox.com/mysql-table-structure-describe/