(PHP 3, PHP 4 , PHP 5)

mysql_field_len --  Returns the length of the specified field


int mysql_field_len ( resource result, int field_offset)

mysql_field_len() returns the length of the specified field.

Example 1. A mysql_fetch_len() example

= mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!
$result) {
'Could not run query: ' . mysql_error();

// Will get the length of the value in email so for example
// would give us a length of 16
$length = mysql_fetch_len($result, 'email');

For downward compatibility mysql_fieldlen() can also be used. This is deprecated, however.

See also mysql_fetch_lengths() and strlen().