Join Up!
96806 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousmysql_create_dbmysql_db_namenext
Last updated: Tue, 29 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Czech | Finnish | German

mysql_data_seek

(PHP 3, PHP 4 )

mysql_data_seek -- Mueve el puntero interno

Descripción

int mysql_data_seek ( int id_resultado, int numero_de_fila)

Devuelve: verdadero si exito, falso si error.

mysql_data_seek() mueve el puntero de fila interno a la fila especificada para el identificador de resultado. La próxima llamada a mysql_fetch_row() devolverá esa fila.

numero_de_fila empieza en 0.

Ejemplo 1. Ejemplo de MySQL data seek

<?php
    $link = mysql_pconnect ("kron", "jutta", "geheim") {
        or die ("Could not connect");
    }

    mysql_select_db ("samp_db") {
        or die ("Could not select database");
    }

    $query = "SELECT last_name, first_name FROM friends";
    $result = mysql_query ($query) {
        or die ("Query failed");
    }

    # fetch rows in reverse order

    for ($i = mysql_num_rows ($result) - 1; $i >=0; $i--) {
        if (!mysql_data_seek ($result, $i)) {
            printf ("Cannot seek to row %d\n", $i);
            continue;
        }

        if(!($row = mysql_fetch_object ($result)))
            continue;

        printf ("%s %s<BR>\n", $row->last_name, $row->first_name);
    }

    mysql_free_result ($result);
?>
User Contributed Notes
mysql_data_seek
add a note about notes
There are no user contributed notes for this page.
previousmysql_create_dbmysql_db_namenext
Last updated: Tue, 29 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST