<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqli-stmt.data-seek" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>mysqli_stmt::data_seek</refname>
  <refname>mysqli_stmt_data_seek</refname>
  <refpurpose>Adjusts the result pointer to an arbitrary row in the buffered result</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <para>&style.oop;</para>
  <methodsynopsis role="mysqli_stmt">
   <modifier>public</modifier> <type>void</type><methodname>mysqli_stmt::data_seek</methodname>
   <methodparam><type>int</type><parameter>offset</parameter></methodparam>
  </methodsynopsis>
  <para>&style.procedural;</para>
  <methodsynopsis>
   <type>void</type><methodname>mysqli_stmt_data_seek</methodname>
   <methodparam><type>mysqli_stmt</type><parameter>statement</parameter></methodparam>
   <methodparam><type>int</type><parameter>offset</parameter></methodparam>
  </methodsynopsis>
  <para>
   This function moves the result set pointer of the buffered result set to
   an arbitrary row specified by the <parameter>offset</parameter> parameter.
  </para>
  <para>
   This function works only on the buffered internal result set.
   <function>mysqli_stmt_store_result</function> must be called prior to
   <function>mysqli_stmt_data_seek</function>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &mysqli.stmt.description;
    <varlistentry>
     <term><parameter>offset</parameter></term>
     <listitem>
      <para>
       Must be between zero and the total number of rows minus one (0..
       <function>mysqli_stmt_num_rows</function> - 1).
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

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

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

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

$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$stmt = $mysqli->prepare($query);
$stmt->execute();

$stmt->bind_result($name, $code);

$stmt->store_result();

/* seek to row no. 400 */
$stmt->data_seek(399);

$stmt->fetch();

printf("City: %s  Countrycode: %s\n", $name, $code);
]]>
   </programlisting>
  </example>
  <example>
   <title>&style.procedural;</title>
   <programlisting role="php">
<![CDATA[
<?php

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

$query = "SELECT Name, CountryCode FROM City ORDER BY Name";
$stmt = mysqli_prepare($link, $query);

mysqli_stmt_execute($stmt);

mysqli_stmt_bind_result($stmt, $name, $code);

mysqli_stmt_store_result($stmt);

/* seek to row no. 400 */
mysqli_stmt_data_seek($stmt, 399);

mysqli_stmt_fetch($stmt);

printf("City: %s  Countrycode: %s\n", $name, $code);
]]>
   </programlisting>
   &examples.outputs;
   <screen>
<![CDATA[
City: Benin City  Countrycode: NGA
]]>
   </screen>
  </example>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>mysqli_prepare</function></member>
    <member><function>mysqli_stmt_store_result</function></member>
    <member><function>mysqli_stmt_num_rows</function></member>
    <member><function>mysqli_data_seek</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
-->
