fetch.phpt 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. ocifetch() & ociresult()
  3. --EXTENSIONS--
  4. oci8
  5. --FILE--
  6. <?php
  7. require(__DIR__."/connect.inc");
  8. // Initialize
  9. $stmtarray = array(
  10. "drop table fetch_tab",
  11. "create table fetch_tab (id number, value number)",
  12. "insert into fetch_tab (id, value) values (1,1)",
  13. "insert into fetch_tab (id, value) values (1,1)",
  14. "insert into fetch_tab (id, value) values (1,1)",
  15. );
  16. oci8_test_sql_execute($c, $stmtarray);
  17. // Run Test
  18. if (!($s = oci_parse($c, "select * from fetch_tab"))) {
  19. die("oci_parse(select) failed!\n");
  20. }
  21. if (!oci_execute($s)) {
  22. die("oci_execute(select) failed!\n");
  23. }
  24. while(oci_fetch($s)) {
  25. $row = oci_result($s, 1);
  26. $row1 = oci_result($s, 2);
  27. var_dump($row);
  28. var_dump($row1);
  29. }
  30. // Cleanup
  31. $stmtarray = array(
  32. "drop table fetch_tab"
  33. );
  34. oci8_test_sql_execute($c, $stmtarray);
  35. echo "Done\n";
  36. ?>
  37. --EXPECT--
  38. string(1) "1"
  39. string(1) "1"
  40. string(1) "1"
  41. string(1) "1"
  42. string(1) "1"
  43. string(1) "1"
  44. Done