The mysqli_fetch_lengths() function returns the length of the fields in the result set.
mysqli_fetch_lengths(result);
$val) { printf("Field %2d has length: %2d\n",$i+1,$val); } // Free result set mysqli_free_result($result); } mysqli_close($con); ?>