Original MySQL API (
Mysql
)
2266
mysql_fetch_lengths
stores the lengths of each result column in the last row returned by
mysql_fetch_row
,
mysql_fetch_assoc
,
mysql_fetch_array
, and
mysql_fetch_object
in
an array, starting at offset 0.
Parameters
result
The result resource that is being evaluated. This result comes from
a call to
mysql_query
.
Return Values
An array of lengths on success or
FALSE
on failure.
Examples
Example 20.44. A
mysql_fetch_lengths
example
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_assoc($result);
$lengths = mysql_fetch_lengths($result);
print_r($row);
print_r($lengths);
?>
The above example will output something similar to:
Array
(
[id] => 42
[email] => [email protected]
)
Array
(
[0] => 2
[1] => 16
)
See Also
mysql_field_len
mysql_fetch_row
strlen
20.7.2.5.17.
mysql_fetch_object
Copyright 1997-2012 the PHP Documentation Group. [2230]
•
mysql_fetch_object
Fetch a result row as an object
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
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 ...