mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@329325 c90b9560-bf6c-de11-be94-00142212c4b1
111 lines
3.3 KiB
XML
111 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.sqlsrv-num-rows" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>sqlsrv_num_rows</refname>
|
|
<refpurpose>Retrieves the number of rows in a result set</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>sqlsrv_num_rows</methodname>
|
|
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Retrieves the number of rows in a result set. This function requires that the
|
|
statment resource be created with a static or keyset cursor. For more information,
|
|
see <function>sqlsrv_query</function>, <function>sqlsrv_prepare</function>,
|
|
or <link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying a Cursor Type and Selecting Rows</link>
|
|
in the Microsoft SQLSRV documentation.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>stmt</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The statement for which the row count is returned. The statment resource
|
|
must be created with a static or keyset cursor. For more information, see
|
|
<function>sqlsrv_query</function>, <function>sqlsrv_prepare</function>, or
|
|
<link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying a Cursor Type and Selecting Rows</link>
|
|
in the Microsoft SQLSRV documentation.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the number of rows retrieved on success and &false; if an error occurred.
|
|
If a forward cursor (the default) or dynamic cursor is used, &false; is returned.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>sqlsrv_num_rows</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$server = "serverName\sqlexpress";
|
|
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
|
|
$conn = sqlsrv_connect( $server, $connectionInfo );
|
|
|
|
$sql = "SELECT * FROM Table_1";
|
|
$params = array();
|
|
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
|
|
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
|
|
|
|
$row_count = sqlsrv_num_rows( $stmt );
|
|
|
|
if ($row_count === false)
|
|
echo "Error in retrieveing row count.";
|
|
else
|
|
echo $row_count;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>sqlsrv_has_rows</function></member>
|
|
<member><function>sqlsrv_rows_affected</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
|
|
-->
|