[>>]

Montag, 16. Februar 2009

PHP MySQL: Read out Comments from Table-Fields

Since Version 4.1 (or 5?) of MySQL you can comment each field of a table. Here is an example how to get these field-comments in PHP:
// Name of Table
$myTab = 'myTable';

// Resultarray (Fieldname => Comment)
$fieldComments = array(); 

// Get the Values
$tabFields = mysql_query('SHOW FULL COLUMNS
                          FROM `'.$myTab.'`');
while ($fieldAtts = mysql_fetch_assoc($tabFields)){
    if (! empty($fieldAtts['Comment'])){
        $fieldComments[$fieldAtts['Field']]
          = $fieldAtts['Comment'];
    }
}

// Example: Output to Browser
echo '<pre>'.print_r ($fieldComments, true).'</pre>';

Trackback URL:
http://sysout.twoday.net/stories/5521006/modTrackback

Suche

 

Aktuelle Beiträge

[Drupal] Debugged Teaser...
Die aktuelle offizielle Version 6.x-1.5 des Teaser...
techomatic - 5. Dez, 22:02
Aljoscha - Funktionärssohn
Ein kurzes, sehenswertes Portrait des DDR-Schweizers...
techomatic - 26. Nov, 02:46
CERN - Schwarze Löcher!
Erneuter Schwarze-Löcher-Alarm - Der LHC wird...
techomatic - 21. Nov, 22:36
Absolute Empfehlung
Ich möchte euch zwei Sendungen an Herz legen,...
techomatic - 11. Nov, 01:20
Danke
Danke für den Hinweis. Ich habe neben dem Microsoft...
User (Gast) - 5. Nov, 08:45

Credits

Knallgrau New Media Solutions - Web Agentur f�r neue Medien

powered by Antville powered by Helma


xml version of this page

twoday.net AGB

Status

Online seit 681 Tagen
Zuletzt aktualisiert: 5. Dez, 22:02