PHP Manual
Prev |  | Next

# OCIRowCount

OCIRowCount -- Gets the number of affected rows

## Description

`int OCIRowCount`(int statement);

OCIRowCounts() returns the number of rows affected for eg update-statements. This funtions will not tell you the number of rows that a select will return!

Example 1. OCIRowCount

      1
      2 <?php
      3     print "<HTML><PRE>";
      4     $conn = OCILogon("scott","tiger");
      5     $stmt = OCIParse($conn,"create table emp2 as select * from emp");
      6     OCIExecute($stmt);
      7     print OCIRowCount($stmt) . " rows inserted.<BR>";
      8     OCIFreeStatement($stmt);
      9     $stmt = OCIParse($conn,"delete from emp2");
     10     OCIExecute($stmt);
     11     print OCIRowCount($stmt) . " rows deleted.<BR>";
     12     OCICommit($conn);
     13     OCIFreeStatement($stmt);
     14     $stmt = OCIParse($conn,"drop table emp2");
     15     OCIExecute($stmt);
     16     OCIFreeStatement($stmt);
     17     OCILogOff($conn);
     18     print "</PRE></HTML>";
     19 ?>

Prev | Home | Next
OCINewDescriptor | Up | OCINumCols