mysql_field_len

(PHP 3, PHP 4 , PHP 5)

mysql_field_len --  Returns the length of the specified field

Description

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

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

// Will get the length of the value in email so for example
// user@example.com would give us a length of 16
$length = mysql_fetch_len($result, 'email');
echo
$length;
?>

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

See also mysql_fetch_lengths() and strlen().