#35344 [Opn->Fbk]: oci_fetch_assoc or oci_fetch_array returns nothing, but oci_fetch_all works OK

From: Date: Wed, 23 Nov 2005 08:18:58 +0000
Subject: #35344 [Opn->Fbk]: oci_fetch_assoc or oci_fetch_array returns nothing, but oci_fetch_all works OK
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88761@lists.php.net to get a copy of this message
ID: 35344 Updated by: sniper@php.net Reported By: sdb at mail dot chita dot ru -Status: Open +Status: Feedback Bug Type: OCI8 related Operating System: Red Hat Enterprise Linux AS PHP Version: 5.0.5 New Comment: Try doing 'var_dump($a);' Previous Comments: ------------------------------------------------------------------------ [2005-11-23 07:19:35] sdb at mail dot chita dot ru Description: ------------ My script successfully connects to oracle, parse and execute simple query (select * from some_table). Functions oci_fetch_assoc, oci_fetch_array, oci_fetch_row does not return an array. When I try to do "each" with returned array, PHP prints "Variable passed to each() is not an array or object" oci_num_fields returns right count of columns in result and oci_field_name returns right column names in loop. Function oci_fetch_all works good, it returns result (array of fields and values), that I expect. Reproduce code: --------------- $c=oci_new_connect("a", "b" , "c", "AMERICAN_AMERICA.CL8MSWIN1251"); $s = oci_parse($c, "SELECT NAME from ABONENT"); if (oci_execute($s, OCI_DEFAULT)) { while($a=oci_fetch_assoc($s)) { while (list($key, $val) = each($a)) { echo $key." = ".$val."<br>"; }; }; }; Expected result: ---------------- Something like that: NAME = aaa NAME = bbb ... Actual result: -------------- Warning: Variable passed to each() is not an array or object in /var/www/test3.php on line 27 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35344&edit=1

« previous php.bugs (#88761) next »