Counting number of SELECTED rows in Oracle with PHP Counting number of SELECTED rows in Oracle with PHP oracle oracle

Counting number of SELECTED rows in Oracle with PHP


Why do the initial count at all? Just issue your select for the movie title. If it's not found, do your error processing. If it is, continue on! If you really need the count, use an analytic to add the count to your query:

'SELECT title, year, synopsis, poster_url      , COUNT(*) OVER (PARTITION BY mid) mcount   FROM movies  WHERE mid = '.$mid

The same goes for your genre selection.

EDIT:

Oracle documentation on Analytic Functions link. I found that analytics are a bit difficult to get from the Oracle docs. Analytic functions by Example by Shouvik Basu provides some simple guidance as to how to use them and helped me quite a bit.


You can try this

$conn = oci_pconnect('user', 'password', 'connectionstring');$resource = oci_parse($conn, $sql);oci_execute($resource, OCI_DEFAULT);$results=array();$numrows = oci_fetch_all($resource, $results, null, null, OCI_FETCHSTATEMENT_BY_ROW);

Cheers


you can use the ocirowcount it should behave just like mysql_num_rows when making a select