You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
669 B

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