<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/mysql.xml, last change in rev 1.2 -->
<refentry id="function.mysql-num-rows">
 <refnamediv>
  <refname>mysql_num_rows</refname>
  <refpurpose>Get number of rows in result</refpurpose>
 </refnamediv>
 <refsect1>
  <title>Description</title>
  <methodsynopsis>
   <type>int</type><methodname>mysql_num_rows</methodname>
   <methodparam><type>resource</type><parameter>result</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>mysql_num_rows</function> returns the number of rows in
   a result set. This command is only valid for SELECT statements.
   To retrieve the number of rows affected by a INSERT, UPDATE or
   DELETE query, use <function>mysql_affected_rows</function>.
   <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>
  <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>
  <para>
   See also
   <function>mysql_affected_rows</function>,
   <function>mysql_connect</function>,
   <function>mysql_data_seek</function>,
   <function>mysql_select_db</function> and
   <function>mysql_query</function>.
  </para>
  <para>
   For downward compatibility <function>mysql_numrows</function> can
   also be used. This is deprecated however.
  </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:"../../../../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
-->