mysql_field_type

(PHP 3, PHP 4 >= 4.0.0)

mysql_field_type --  Liefert den Typ eines Feldes in einem Anfrageergebnis

Beschreibung

string mysql_field_type (int Ergebnis-Kennung, int Feldoffset)

mysql_field_type() ist ähnlich zu mysql_field_name(). Die Argumente sind identisch, aber der Feldtyp wird zurückgeliefert. Dieser kann einer von "int", "real", "string", "blob", oder anderen sein, wie in der Dokumentation zu MySQL angegeben.

Beispiel 1. Mysql Field Types


<?php 
mysql_connect ("localhost:3306");
mysql_select_db ("wisconsin");
$result = mysql_query ("SELECT * FROM onek");
$fields = mysql_num_fields ($result);
$rows   = mysql_num_rows ($result);
$i = 0;
$table = mysql_field_table ($result, $i);
echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>";
echo "The table has the following fields <BR>"; 
while ($i < $fields) {
    $type  = mysql_field_type  ($result, $i);
    $name  = mysql_field_name  ($result, $i);
    $len   = mysql_field_len   ($result, $i);
    $flags = mysql_field_flags ($result, $i);
    echo $type." ".$name." ".$len." ".$flags."<BR>";
    $i++;
}
mysql_close();
?>
      

Für Abwärtskompatibilität kann mysql_fieldtype() verwendet werden.