Jump to content

Help: Retrieving data from an oracle db


Recommended Posts

i am completely lost now and can not work out why no data is being retrieved when i run a query.


I have set up oracle and php on my localhost using;



oci8 library

oracle 10g express (universal)

oracle instant client


I am establishing a connection without any problem, but when i run a query and return results, it returns 0 :S.


here's the code;


$connect = oci_connect('myusername', 'mypassword', '');


$result = OCIParse($connect, $query);



echo OCI_Num_Rows($result);


it returns 0 when in fact there are 5 records...i run the same query directly using oracle's interface and it works fine, it's just not working when i try it using PHP.


any advice?




Link to post
Share on other sites

From the oci_num_rows documentation -




This function does not return number of rows selected! For SELECT statements this function will return the number of rows, that were fetched to the buffer with oci_fetch*() functions.




Link to post
Share on other sites

thanks a lot....


        the below worked;



ocifetchstatement($result,$tab_result);  // the result will be fetched in the table $tab_result

echo ocirowcount($result);

Link to post
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.