Help with oci_result()

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello everyone,

I am trying to get the result of a query in a php variable
I wander what's wrong with this code because I don't get a value in $val, I  
am sure my select is correct as it returns a value in SQL worksheet for  


$val = 'test';

print "value = $val <br>";


$sql="select fruit_name from fruits where fruit_id=2";


oci_execute($stmt, oci_default);


$val = oci_result($stmt,0);


print "value = $val ";


Re: Help with oci_result()


Try to place the name of the field you are trying to get such as
$val = oci_result($stmt,"fruit_name");

You can also check the following page for more details

Re: Help with oci_result()

On Sun, 09 Apr 2006 13:42:34 -0700, seajay wrote:

Quoted text here. Click to load it

That will work. Also, oci_result starts counting columns with 1, not with
0. I responded to this on


Site Timeline