<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqli.close" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>mysqli::close</refname>
  <refname>mysqli_close</refname>
  <refpurpose>Closes a previously opened database connection</refpurpose>
 </refnamediv>
 
 <refsect1 role="description">
  &reftitle.description;
  <para>&style.oop;</para>
  <methodsynopsis role="mysqli">
   <modifier>public</modifier> <type>true</type><methodname>mysqli::close</methodname>
   <void/>
  </methodsynopsis>
  <para>&style.procedural;</para>
  <methodsynopsis>
   <type>true</type><methodname>mysqli_close</methodname>
   <methodparam><type>mysqli</type><parameter>mysql</parameter></methodparam>
  </methodsynopsis>
  <para>
   Closes a previously opened database connection.
  </para>
  <para>
   Open non-persistent MySQL connections and result sets are automatically
   closed when their objects are destroyed. Explicitly closing open 
   connections and freeing result sets is optional. However, it's a good idea
   to close the connection as soon as the script finishes performing all of its
   database operations, if it still has a lot of processing to do after
   getting the results.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &mysqli.link.description;
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.true.always;
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>8.0.0</entry>
       <entry>
        This function now always returns &true;. Previously it returned &false; on failure.
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <title><methodname>mysqli::close</methodname> example</title>
   <para>&style.oop;</para>
   <programlisting role="php">
<![CDATA[
<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

$result = $mysqli->query("SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");

/* Close the connection as soon as it's no longer needed */
$mysqli->close();

foreach ($result as $row) {
    /* Processing of the data retrieved from the database */
}
]]>
   </programlisting>
   <para>&style.procedural;</para>
   <programlisting role="php">
<![CDATA[
<?php

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = mysqli_connect("localhost", "my_user", "my_password", "world");

$result = mysqli_query($mysqli, "SELECT Name, CountryCode FROM City ORDER BY ID LIMIT 3");

/* Close the connection as soon as it's no longer needed */
mysqli_close($mysqli);

foreach ($result as $row) {
    /* Processing of the data retrieved from the database */
}
]]>
   </programlisting>
  </example>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    <function>mysqli_close</function> will not close persistent connections. 
    For additional details, see the manual page on
    <link linkend="features.persistent-connections">persistent connections</link>.
   </para>
  </note>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>mysqli::__construct</methodname></member>
    <member><function>mysqli_init</function></member>
    <member><function>mysqli_real_connect</function></member>
    <member><function>mysqli_free_result</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
-->
