php-doc-en/reference/mysql/functions/mysql-fetch-lengths.xml
Christoph Michael Becker b95d28e6ec Fix return types
Functions which return false on failure should state that in their
signature as well.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351135 c90b9560-bf6c-de11-be94-00142212c4b1
2020-11-02 15:52:35 +00:00

127 lines
3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysql-fetch-lengths" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>mysql_fetch_lengths</refname>
<refpurpose>Get the length of each output in a result</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
&mysql.alternative.note;
<simplelist role="alternatives">
<member><function>mysqli_fetch_lengths</function></member>
<member><methodname>PDOStatement::getColumnMeta</methodname></member>
</simplelist>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>false</type></type><methodname>mysql_fetch_lengths</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the lengths of each field
in the last row fetched by MySQL.
</para>
<para>
<function>mysql_fetch_lengths</function> stores the lengths of
each result column in the last row returned by
<function>mysql_fetch_row</function>,
<function>mysql_fetch_assoc</function>,
<function>mysql_fetch_array</function>, and
<function>mysql_fetch_object</function> in an array, starting at
offset 0.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&mysql.result.description;
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
An <type>array</type> of lengths on success&return.falseforfailure;.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>mysql_fetch_lengths</function> example</title>
<programlisting role="php">
<![CDATA[
<?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);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
[id] => 42
[email] => user@example.com
)
Array
(
[0] => 2
[1] => 16
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mysql_field_len</function></member>
<member><function>mysql_fetch_row</function></member>
<member><function>strlen</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->