IT & Programming

Display mysql field length with PHP

  1. How to display mysql field length.
  2. Show mysql table's field length with php.
  3. List all field lengths of mysql table.

This script lists field length of all mysql table fields.

Script

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

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

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

Output

11, 250, 5, 5, 65535

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 *