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;

 

xamp

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', '127.0.0.1');

$query = 'SELECT * FROM EMPLOYEES';

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

 

OCIExecute($result);

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 comment
https://forums.phpfreaks.com/topic/233097-help-retrieving-data-from-an-oracle-db/
Share on other sites

From the oci_num_rows documentation -

 

Note:

 

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.

 

 

 

Archived

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.