ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:recordcount

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
reference:recordcount [2015/07/25 06:18] – created mnewnhamv5:reference:connection:recordcount [2018/05/03 14:36] – [Usage] Fix incorrect code per https://github.com/ADOdb/ADOdb/issues/417 dregad
Line 1: Line 1:
 ====== recordCount ===== ====== recordCount =====
 <WRAP right box> <WRAP right box>
 +== See Also ==
 +[[v5:database:feature_comparison|Feature Comparison Matrix]]
 +== Syntax ==
    int recordCount()    int recordCount()
 </WRAP> </WRAP>
-The function ''recordCount()'' return the number of records returned by the last select statement, or -1 if the database driver does not support the operation. +The function ''recordCount()'' return the number of records returned by the last select statement, or -1 if the database driver does not support the operation.  
-</WRAP>+ 
 +If [[v5:reference:adodb_countrecs|$ADODB_COUNTRECS]] is set to true before a query is executed, then the number of records will be retrieved, even if the function has to be emulated by issuing a ''COUNT *'' on the query. This can result in slow responses. 
 +---------------------------- 
 +===== Usage ===== 
 +<code php> 
 +/
 + * Existing database connection assumed 
 + */ 
 +$result = $db->Execute('SELECT * FROM act'); 
 +$recordCount = $result->recordCount(); 
 +</code>
  
v5/reference/connection/recordcount.txt · Last modified: 2018/05/03 14:39 by dregad