Access MySQL field's Comments with PHP

Use:

SHOW FULL COLUMNS FROM tbl_name

Notice keyword FULL, this is what makes MySQL to include privileges and comments info into the response.


Poke around information_schema.

SELECT table_comment
FROM information_schema.tables
WHERE table_schema = 'myschema' AND table_name = 'mytable'

SELECT 
    COLUMN_COMMENT
FROM 
    information_schema.COLUMNS
WHERE
    TABLE_NAME = 'venue'

Great to use for table column headings or more readable/secure version of real column names. Ex., The column for Venue ID is actually vid_xt

Sample Result from actual query above:

COLUMN_COMMENT
Venue ID
Venue Active
Venue Name
Location Name
Address
Accommodations
Description

Tags:

Mysql

Php