mits Posted April 8, 2011 Share Posted April 8, 2011 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? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 8, 2011 Share Posted April 8, 2011 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. Quote Link to comment Share on other sites More sharing options...
mits Posted April 8, 2011 Author Share Posted April 8, 2011 thanks a lot.... the below worked; ociexecute($result); ocifetchstatement($result,$tab_result); // the result will be fetched in the table $tab_result echo ocirowcount($result); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.