The usage of sqlite_fetch_all should be your choise
(instead the well known practice of "while()" loop)
when unmodified tabledata is prefered.
Example code for a better illustration:
<?php
if ($dbhandle = sqlite_open('mysqlitedb', 0666, $sqliteerror)):
$query = "SELECT x, y FROM sometable LIMIT 3;";
$result = sqlite_query($dbhandle, $query);
// usage with sqlite_fetch_all
$array1 = sqlite_fetch_all($result, SQLITE_ASSOC);
// the "well known practice"
$i = '0';
while ($row = sqlite_fetch_array($result, SQLITE_ASSOC)):
$array2["$i"] = $row;
$i++;
endwhile;
sqlite_close($dbhandle);
endif;
?>
There are no differents within the values of array1 and array2.
Both arrays will be something like:
Array
(
[0] => Array
(
[x] => 22004
[y] => example_data1
)
[1] => Array
(
[x] => 92044
[y] => example_data2
)
[2] => Array
(
[x] => 143060
[y] => example_data3
)
)
If you want to let me know about your comments, feel
free to send me a note via feedback-formular at:
http://www.d0x.de/pages/kontakt.php
sqlite_fetch_all
(PHP 5, PECL sqlite:1.0-1.0.3)
sqlite_fetch_all — Выбирает все записи из результата запроса и возвращает массив массивов
Описание
array sqlite_fetch_all
( resource $result
[, int $result_type
[, bool $decode_binary
]] )
Внимание
К настоящему времени эта функция еще не была документирована; для ознакомления доступен только список аргументов.
sqlite_fetch_all
Minots Estich <minots at D0X dot de>
21-Oct-2004 09:15
21-Oct-2004 09:15
