sqlite_seek() problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello !!

When I make a query with sqlite_query() and use sqlite_fetch_array() all
works well:

Example:

$result = sqlite_query('SELECT * FROM test', $conn);
while($row = sqlite_fetch_array($resulr, SQLITE_NUM, true)){
    $rows[] = $row;
}

$rows is:

Array
(
    [0] => Array
        (
            [0] => 1
            [1] => toro
            [2] => 10
            [3] => 500.00
        )

    [1] => Array
        (
            [0] => 2
            [1] => gallo
            [2] => 5
            [3] => 200.00
        )

    [2] => Array
        (
            [0] => 3
            [1] => rana
            [2] => 20
            [3] => 100.00
        )

    [3] => Array
        (
            [0] => 4
            [1] => cane
            [2] => 3
            [3] => 500.00
        )

)

if I use sqlite_seek() and sqlite_current:

if(sqlite_seek($result,1)){
    $row = sqlite_current($result, SQLITE_NUM, true);
}

$row is:

Array
        (
            [0] => 2
            [1] => gallo
            [2] => 5
            [3] => 200.00
        )

in place of the first record return the second (The row number is
one-based (1 is the first row) in sqlite_seek()).
using sqlite_rewrite() and sqlite_current() I obtain the first record,
but it is not possible to obtainthe first record 
of a rowset with sqlite_seek() and sqlite_current()? I am writing a
pretty class for SQLite, this is the last problem 
that I have before the release :) but I do not find other documentation
for sqlite and PHP.

Thank

Alan D'Angelo

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux