1--TEST-- 2oci_fetch_assoc() 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> 5--FILE-- 6<?php 7 8require __DIR__."/connect.inc"; 9 10$stmtarray = array( 11 "drop table fetch_assoc_tab", 12 "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))", 13 "insert into fetch_assoc_tab values (1,1,null)", 14 "insert into fetch_assoc_tab values (1,1,null)", 15 "insert into fetch_assoc_tab values (1,1,null)" 16); 17 18oci8_test_sql_execute($c, $stmtarray); 19 20$select_sql = "select * from fetch_assoc_tab"; 21 22if (!($s = oci_parse($c, $select_sql))) { 23 die("oci_parse(select) failed!\n"); 24} 25 26if (!oci_execute($s)) { 27 die("oci_execute(select) failed!\n"); 28} 29while ($row = oci_fetch_assoc($s)) { 30 var_dump($row); 31} 32 33// Clean up 34 35$stmtarray = array( 36 "drop table fetch_assoc_tab" 37); 38 39oci8_test_sql_execute($c, $stmtarray); 40 41echo "Done\n"; 42 43?> 44--EXPECT-- 45array(3) { 46 ["ID"]=> 47 string(1) "1" 48 ["VALUE"]=> 49 string(1) "1" 50 ["DUMMY"]=> 51 NULL 52} 53array(3) { 54 ["ID"]=> 55 string(1) "1" 56 ["VALUE"]=> 57 string(1) "1" 58 ["DUMMY"]=> 59 NULL 60} 61array(3) { 62 ["ID"]=> 63 string(1) "1" 64 ["VALUE"]=> 65 string(1) "1" 66 ["DUMMY"]=> 67 NULL 68} 69Done 70