Solved

Show Column Comment - MySQL - PHP

Posted on 2010-09-08
3
1,205 Views
Last Modified: 2012-05-10
Hi E's,
I want to know how I get/show the comment of each column in my table (MySQL).

For example, I use this code for get the name of columns:
$tnames_result = mysql_query("SHOW COLUMNS FROM zz_botoes FROM wwdablio_www", $db);
$tnames_rows = mysql_num_rows($tnames_result);
while($tnames = mysql_fetch_array($tnames_result)){
echo $tnames[0];
}

Note: zz_botoes is the name of the table, and wwdablio_www was the name of db.
How I do for see the comments of each column of table zz_botoes?

Regards, JC
0
Comment
Question by:Pedro Chagas
  • 2
3 Comments
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 33630061
Include the word FULL before COLUMNS

SHOW FULL COLUMNS FROM.....

Your result will include a column called 'comments'


0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 33630076
Sorry, that should be 'Comment'



$tnames_result = mysql_query("SHOW FULL COLUMNS FROM zz_botoes FROM wwdablio_www", $db);
$tnames_rows = mysql_num_rows($tnames_result);
while($tnames = mysql_fetch_array($tnames_result)){
echo $tnames[0];
echo $tnames['Comment'];
}

Open in new window

0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 33630183
SHOW FULL COLUMNS FROM...
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question