$sql = "
SELECT
COLUMNS.TABLE_NAME, COLUMNS.COLUMN_DEFAULT, COLUMNS.ORDINAL_POSITION, COLUMNS.COLUMN_NAME, COLUMNS.COLUMN_TYPE, COLUMNS.COLUMN_KEY, COLUMNS.EXTRA, COLUMNS.COLUMN_COMMENT, TABLES.TABLE_COMMENT
FROM
information_schema.COLUMNS
LEFT JOIN information_schema.TABLES ON TABLES.TABLE_NAME = COLUMNS.TABLE_NAME
WHERE
COLUMNS.TABLE_SCHEMA = '{$dbname}'
";