<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysql-free-result" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>mysql_free_result</refname>
  <refpurpose>Free result memory</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
  <warning>
   &mysql.alternative.note;
   <simplelist role="alternatives">
    <member><function>mysqli_free_result</function></member>
    <member>Assign the value of &null; to the PDO object, or <methodname>PDOStatement::closeCursor</methodname></member>
   </simplelist>
  </warning>
 </refsynopsisdiv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>mysql_free_result</methodname>
   <methodparam><type>resource</type><parameter>result</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>mysql_free_result</function> will free all memory
   associated with the result identifier <parameter>result</parameter>.
  </para>
  <para>
   <function>mysql_free_result</function> only needs to be called if
   you are concerned about how much memory is being used for queries
   that return large result sets.  All associated result memory is
   automatically freed at the end of the script's execution.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &mysql.result.description;
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
  <para>
   If a non-resource is used for the <parameter>result</parameter>, an
   error of level E_WARNING will be emitted.  It's worth noting that
   <function>mysql_query</function> only returns a <type>resource</type>
   for SELECT, SHOW, EXPLAIN, and DESCRIBE queries.
  </para>
 </refsect1>
 
  <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <function>mysql_free_result</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;
}
/* Use the result, assuming we're done with it afterwards */
$row = mysql_fetch_assoc($result);

/* Now we free up the result and continue on with our script */
mysql_free_result($result);

echo $row['id'];
echo $row['email'];
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    &info.deprecated.alias;
    <function>mysql_freeresult</function>
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>mysql_query</function></member>
    <member><function>is_resource</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
-->
