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
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.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.