<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mysql-num-rows" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>mysql_num_rows</refname>
  <refpurpose>Get number of rows in result</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>int</type><methodname>mysql_num_rows</methodname>
   <methodparam><type>resource</type><parameter>result</parameter></methodparam>
  </methodsynopsis>
  <para>
   Retrieves the number of rows from a result set. This command is only valid 
   for statements like SELECT or SHOW that return an actual result set. 
   To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or 
   DELETE query, use <function>mysql_affected_rows</function>.
  </para>
 </refsect1>

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

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The number of rows in a result set on success&return.falseforfailure;.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>mysql_num_rows</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php

$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("database", $link);

$result = mysql_query("SELECT * FROM table1", $link);
$num_rows = mysql_num_rows($result);

echo "$num_rows Rows\n";

?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <note>
   <para>
    If you use <function>mysql_unbuffered_query</function>, 
    <function>mysql_num_rows</function> will not return the 
    correct value until all the rows in the result set have been 
    retrieved.
   </para>
  </note>
  <note>
   <para>
    &info.deprecated.alias;
    <function>mysql_numrows</function>
   </para>
  </note>
 </refsect1>

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