xref: /PHP-5.3/ext/sqlite/tests/sqlite_025.phpt (revision 610c7fbe)
1--TEST--
2sqlite: sqlite_fetch_object in a loop
3--INI--
4sqlite.assoc_case=0
5--SKIPIF--
6<?php # vim:ft=php
7if (!extension_loaded("sqlite")) print "skip"; ?>
8--FILE--
9<?php
10include "blankdb.inc";
11
12sqlite_query($db, "CREATE TABLE strings(a)");
13
14foreach (array("one", "two", "three") as $str) {
15	sqlite_query($db, "INSERT INTO strings VALUES('$str')");
16}
17
18$res = sqlite_query("SELECT * FROM strings", $db);
19
20while (($obj = sqlite_fetch_object($res))) {
21	var_dump($obj);
22}
23
24sqlite_close($db);
25?>
26--EXPECTF--
27object(stdClass)#1 (1) {
28  ["a"]=>
29  string(3) "one"
30}
31object(stdClass)#2 (1) {
32  ["a"]=>
33  string(3) "two"
34}
35object(stdClass)#1 (1) {
36  ["a"]=>
37  string(5) "three"
38}