Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 1146

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>mysql_data_seek</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="MySQL functions"
HREF="ref.mysql.html"><LINK
REL="PREVIOUS"
TITLE="mysql_create_db"
HREF="function.mysql-create-db.html"><LINK
REL="NEXT"
TITLE="mysql_db_query"
HREF="function.mysql-db-query.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.mysql-create-db.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.mysql-db-query.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.mysql-data-seek"
>mysql_data_seek</A
></H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN18537"
></A
>mysql_data_seek -- Move internal result pointer</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN18540"
></A
><H2
>Description</H2
><DIV
CLASS="funcsynopsis"
><P
></P
><CODE
CLASS="FUNCDEF"
>int mysql_data_seek</CODE
>(int result_identifier, int row_number);<P
></P
></DIV
><P
> 
     Returns: true on success, false on failure.
    </P
><P
> 
     <B
CLASS="function"
>mysql_data_seek()</B
> moves the internal row
     pointer of the MySQL result associated with the specified result
     identifier to point to the specified row number.  The next call
     to <A
HREF="function.mysql-fetch-row.html"
><B
CLASS="function"
>mysql_fetch_row()</B
></A
> would return that row.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>Row_number</I
></TT
> starts at 0.
    </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><P
><B
>Example 1. MySQL data seek example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>  1&nbsp;
  2&nbsp;&#60;?php
  3&nbsp;    $link = mysql_pconnect ("kron", "jutta", "geheim") {
  4&nbsp;        or die ("Could not connect");
  5&nbsp;    }
  6&nbsp;
  7&nbsp;    mysql_select_db ("samp_db") {
  8&nbsp;        or die ("Could not select database");
  9&nbsp;    }
 10&nbsp;
 11&nbsp;    $query = "SELECT last_name, first_name FROM friends";
 12&nbsp;    $result = mysql_query ($query) {
 13&nbsp;        or die ("Query failed");
 14&nbsp;    }
 15&nbsp;
 16&nbsp;    # fetch rows in reverse order
 17&nbsp;
 18&nbsp;    for ($i = mysql_num_rows ($result) - 1; $i &#62;=0; $i--) {
 19&nbsp;        if (!mysql_data_seek ($result, $i)) {
 20&nbsp;            printf ("Cannot seek to row %d\n", $i);
 21&nbsp;            continue;
 22&nbsp;        }
 23&nbsp;
 24&nbsp;        if(!($row = mysql_fetch_object ($result)))
 25&nbsp;            continue;
 26&nbsp;
 27&nbsp;        printf ("%s %s&#60;BR&#62;\n", $row-&#62;last_name, $row-&#62;first_name);
 28&nbsp;    }
 29&nbsp;
 30&nbsp;    mysql_free_result ($result);
 31&nbsp;?&#62;
 32&nbsp;     </PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.mysql-create-db.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.mysql-db-query.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>mysql_create_db</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.mysql.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>mysql_db_query</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>