IT & Programming

Display mysql table field type with PHP

  1. How to display mysql table field types.
  2. Show all mysql fielddatatypes with php.
  3. List datatypes of mysql table fields.

This script list all mysql table's field types.

Script

$i=0;
$sql = mysql_query("select * from products");

while( $i < mysql_num_fields($sql)){

    echo mysql_field_type($sql, $i)  .  ', ';
    $i++;
}

Output

int, string, blob, date, time

Leave A comment

Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *