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>';

Suche

 

Aktuelle Beiträge

Anleitung Dieselheizung...
Den beliebten Dieselheizungen aus chinesischer Produktion...
techomatic - 2022-11-13 00:35
Reifendruckkontrolle...
Wenn die Reifendruckkontrollleuchte (Toyota Yaris III)...
techomatic - 2022-10-23 13:58
openSSH-Keys mit Putty(gen)...
Ziel: openSSH-Keypaare unter Windows erzeugen Problem: Putty.. .
techomatic - 2021-02-20 13:59
mp4-Videos mit Virtualdub...
Für Virtualdub gibt es einen sehr guten Entwackler...
techomatic - 2018-11-03 21:26
[SMB] XP WIN7 WIN10 Login...
Wer beim Versuch auf Windows-Freigaben eines XP-Rechners...
techomatic - 2018-05-04 22:04

Credits

powered by Antville powered by Helma


xml version of this page

twoday.net AGB

click tracking

Status

Online seit 5916 Tagen
Zuletzt aktualisiert: 2022-11-17 19:10

System