|
Posted by windandwaves on 07/11/05 13:09
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_description($t) {
$sql = 'SHOW CREATE TABLE `'.$t.'`;';
$query = mysql_query($sql);
$v = mysql_result($query, 0, 1);
if($v) {
$p = strpos($v,"COMMENT=");
if($p) {
return substr($v, $p + 8);
}
}
return 'Table description not found';
}
[Back to original message]
|