Original MySQL API (
Mysql
)
2271
See Also
mysql_field_type
mysql_field_len
20.7.2.5.20.
mysql_field_len
Copyright 1997-2012 the PHP Documentation Group. [2230]
•
mysql_field_len
Returns the length of the specified field
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the
future. Instead, the
MySQLi
or
PDO_MySQL
extension should be used. See
also
MySQL: choosing an API
guide and
related FAQ
for more information.
Alternatives to this function include:
mysqli_fetch_field_direct
[length]
PDOStatement::getColumnMeta
[len]
Description
int mysql_field_len(
resource result,
int field_offset);
mysql_field_len
returns the length of the specified field.
Parameters
result
The result resource that is being evaluated. This result comes from
a call to
mysql_query
.
field_offset
The numerical field offset. The
field_offset
starts at
0
. If
field_offset
does not exist, an error of level
E_WARNING
is also
issued.
Return Values
The length of the specified field index on success or
FALSE
on failure.
Examples
Example 20.49.
mysql_field_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 id field as specified in the database
// schema.
$length = mysql_field_len($result, 0);
echo $length;
?>
Notes
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...