473,811 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieving table comment from mysql database

Hi Gurus

Is there a way to retrieve the table comment from a mysql table.

In PHP My Admin, you can set the comment for a table. however, I was
wondering if you can retrieve it for use in a PHP page.

Any help greatly appreciated.

- Nicolaas
Jul 23 '05 #1
5 2001
windandwaves wrote:
Hi Gurus

Is there a way to retrieve the table comment from a mysql table.

In PHP My Admin, you can set the comment for a table. however, I was
wondering if you can retrieve it for use in a PHP page.

Any help greatly appreciated.


Comment saved in a PHP_My_Admin table.
Jul 23 '05 #2
>Is there a way to retrieve the table comment from a mysql table.

In PHP My Admin, you can set the comment for a table. however, I was
wondering if you can retrieve it for use in a PHP page.

Any help greatly appreciated.


In PHP 5.0.x, it's in information_sch ema.tables.tabl e_comment .

It's also in SHOW CREATE TABLE in PHP 5.0.x and earlier versions.

Gordon L. Burditt
Jul 23 '05 #3
NC
windandwaves wrote:

Is there a way to retrieve the table comment from
a mysql table.


Yes. Run a SHOW CREATE TABLE query on the table you want
to see the comment for. For example, if you have a table
called `example`, the query will be:

SHOW CREATE TABLE example;

It will return a CREATE TABLE statement for the table,
which will include the comment. You will need to parse
it out of the CREATE TABLE statement.

Cheers,
NC

Jul 23 '05 #4
NC wrote:
windandwaves wrote:

Is there a way to retrieve the table comment from
a mysql table.


Yes. Run a SHOW CREATE TABLE query on the table you want
to see the comment for. For example, if you have a table
called `example`, the query will be:

SHOW CREATE TABLE example;

It will return a CREATE TABLE statement for the table,
which will include the comment. You will need to parse
it out of the CREATE TABLE statement.


Thank you for clarifying this.

- Nicolaas
Jul 23 '05 #5
windandwaves wrote:
Hi Gurus

Is there a way to retrieve the table comment from a mysql table.

In PHP My Admin, you can set the comment for a table. however, I was
wondering if you can retrieve it for use in a PHP page.

Any help greatly appreciated.

- Nicolaas


This is the function I made up (I only use one space as indent):

function table_descripti on($t) {
$sql = 'SHOW CREATE TABLE `'.$t.'`;';
$query = mysql_query($sq l);
$v = mysql_result($q uery, 0, 1);
if($v) {
$p = strpos($v,"COMM ENT=");
if($p) {
return substr($v, $p + 8);
}
}
return 'Table description not found';
}
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11336
by: Josep | last post by:
Hi, I'd like to poll a database and get the table contents, as well as the field names from that table. I've been to php.net but this time I cannot find something helpful. I can get the data, and retrieve it into an array noproblem. I can get the data+fieldnames and put it into a list.
3
4487
by: Bert Sierra | last post by:
Hello -- I have what appears to be a simple PHP+MySQL query, but Dreamweaver consistently generates PHP code which won't parse. I've stared at the PHP code for several hours now, and I can't see the problem. Thanks in advance for any input you might have to the problem.
3
6510
by: Oliver Kohll | last post by:
Hi, I can't seem to retrieve a comment on a table column. The following copy from psql should I think return a comment: ==================== mydatabase=> COMMENT ON COLUMN car.manufacturer IS 'manufacturer name'; COMMENT mydatabase=> SELECT relnamespace FROM pg_class WHERE relname='car'; relnamespace
10
1705
by: Krakatioison | last post by:
Hi everyone, can someone point me to download of an example for saving and retrieving to/from MYSQL database. Or did anyone of you tried this and could share your code with me. I've got some data which needs to be put to mysql database using VB.NET and I can't figure this out. Thanks a lot. K.
16
3504
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
3
3647
by: wongwaichi | last post by:
Hi, everyone. I am not sure if i am writing in the correct group. But somehow it relates to MySQL, i hope someone can help me. I am working on a web site which is developed by PHP and MySQL, hosted by a hosting company. Last week, all tables in MySQL suddenly disappeared and a "func" table is created there. I never create that table in my database. I asked the Hosting company what happened. The staff claimed that most probably my...
2
2183
by: gophersounds | last post by:
When I run this simple program I am not getting any data back. The program creates a database, creates a table, populates the table with some data, and then tries to read the data. However, no records are returned in the ResultSet. I verify through MySQL Query Browser that the database is created and populated. I've also been unable to retrieve records with other databases. Because I'm creating the database at the root I don't think admin...
9
35575
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows() Method of the Recordset Object. This Method varies slightly from DAO to ADO, so for purposes of this discussion, we'll be talking about DAO Recordsets. The ADO approach will be addressed in the following Tip. We'll be using a Query, consisting of 5...
1
2898
oranoos3000
by: oranoos3000 | last post by:
hi i have an error with enter record to table in database(mysql) structure of my table is as follow - phpMyAdmin SQL Dump -- version 2.11.6 -- http://www.phpmyadmin.net -- -- Host: localhost
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10402
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9205
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.