如何从SQL获取列注释

As you guys propably know, there's the possibility to add a comment to a column in MySQL. Now I was wondering how I could obtain this comment via PHP/MySQL. I was searching the web but I didn't find any solution yet. Do you guys have any idea/solution for this problem?

Greetings!

SELECT
    COLUMN_COMMENT
FROM
    INFORMATION_SCHEMA.COLUMNS
WHERE
    TABLE_SCHEMA = 'db-name' AND
    TABLE_NAME = 'table-name' AND
    COLUMN_NAME = 'column-name'

http://dev.mysql.com/doc/refman/5.0/en/columns-table.html

Data regarding MySQL's tables in stored in the information_schema views.
You should be able to get it from there. This requires root privileges.

SELECT table_schema, table_name, column_comment 
FROM INFORMATION_SCHEMA.`columns` c
WHERE c.table_schema = 'mydatabase' 
  AND c.table_name = 'mytable'
  AND c.column_name = 'myfield'

Just use this SQL:

SHOW FULL COLUMNS FROM myTable

http://dev.mysql.com/doc/refman/5.0/en/show-columns.html

The FULL keyword causes the output to include the column collation and comments, as well as the privileges you have for each column.

Use the SQL command SHOW FULL COLUMNS as described in the MySQL manual. Its output contains the comments.

You can fetch those metadata from the information_schema database.

Ex:

SELECT column_name, column_comment FROM information_schema.columns WHERE table_name = 'user'

Where user is your table name.

If you have correct privileges you could make this query:

$query = "SHOW FULL COLUMNS from node;";

$result = mysql_query($query);

And then fetch the results (there is a column named Comment that holds the comments)