ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:affected_rows

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:connection:affected_rows [2016/01/16 22:39] – [Description] mnewnhamv5:reference:connection:affected_rows [2022/11/06 23:20] (current) mnewnham
Line 6: Line 6:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The function ''affected_rows()'' returns the number of rows affected (add/change/delete) by the last SQL statement executed, or false if the database does not support the function or the statement is not an update. See the driver documentation for support. Most multi-user databases support the command+The function ''affected_rows()'' returns the number of rows affected (add/change/delete) by the last SQL statement executed, or false if the database does not support the function or the statement is not an update. See the driver documentation for support. Most multi-user databases support the command. Because the method returns ''0'' for zero results and ''false'' for an unsupported statement, it is recommended to use ''==='' if testing for zero or false. 
 + 
 +<WRAP tip> 
 +Because the connection only supports a single global instance of this variable, it is important to **retrieve the value of this method before executing another SQL statement** (of any type). 
 +</WRAP>
  
-**Because the connection only supports a single global instance of this variable, it is important to retrieve the value of this method before executing another SQL statement (of any type).** 
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
Line 14: Line 17:
  * connection assumed  * connection assumed
  */  */
-$db->Execute('DELETE FROM act WHERE actno = 20');+$db->execute('DELETE FROM act WHERE actno = 20');
  
 print $db->affected_rows(); print $db->affected_rows();
Line 21: Line 24:
  */  */
  
-$db->Execute('SELECT FROM act');+$db->execute('SELECT FROM act');
 print $db->affected_rows(); print $db->affected_rows();
 /* /*
Line 27: Line 30:
  */  */
 </code> </code>
 +
  
v5/reference/connection/affected_rows.1452980397.txt.gz · Last modified: 2017/04/21 11:37 (external edit)