note 46732 added to function.sqlite-fetch-all
| From: | MinotsEstich� | Date: | Thu, 21 Oct 2004 16:15:52 +0000 |
| Subject: | note 46732 added to function.sqlite-fetch-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78893@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.sqlite-fetch-all.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46732
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46732&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46732&report=yes
Search -- http://master.php.net/manage/user-notes.php