php8.5
Home/ Manual/ mysql / functions/ mysql_field_len

mysql_field_len

PHP function Edit on GitHub ✎

(PHP 4, PHP 5)

Returns the length of the specified field

Note mysqli_fetch_field_direct [length]PDOStatement::getColumnMeta [len]

Description

mysql_field_len(resource $result, int $field_offset): int|false

mysql_field_len() returns the length of the specified field.

Parameters

Return Values

The length of the specified field index on successFalseforfailure.

Examples

mysql_field_len() example

php
<?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 id field as specified in the database
// schema.
$length = mysql_field_len($result, 0);
echo $length;
?>

Notes

See Also

Source: reference/mysql/functions/mysql-field-len.xml · from the official PHP manual (php/doc-en)