sqlite_seek() problem
| From: | Alan D'Angelo - Media Beat Information Technology | Date: | Mon, 07 Jul 2003 06:34:55 +0000 |
| Subject: | sqlite_seek() problem | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29117@lists.php.net to get a copy of this message | ||
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