Solved

Show Column Comment - MySQL - PHP

Posted on 2010-09-08
3
1,183 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 42

Expert Comment

by:Chris Stanyon
Comment Utility
Include the word FULL before COLUMNS

SHOW FULL COLUMNS FROM.....

Your result will include a column called 'comments'


0
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
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 108

Expert Comment

by:Ray Paseur
Comment Utility
SHOW FULL COLUMNS FROM...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now