- skip to content

# Database Abstraction Layer

### User Tools

- Login

### Site Tools

- Recent changes
- Media Manager
- Sitemap

### Sidebar

##### Resources

- Reference Manual
- User Guide
- The Data Dictionary
- ADOdb-xmlschema
- ADOdb Active Record
- Performance Monitoring
- Date/Time Library
- Session Management Library
- Unsupported Addons
- Coding Standards

##### Supported Databases

- Access
- ADO
- CSV
- Firebird
- Frontbase
- IBM DB2
- Informix
- Interbase
- LDAP
- Microsoft SQL Server
- MySQL
- Netezza
- ODBC
- ODBTP
- Oracle
- PDO
- Postgresql
- SAP ADS
- SAP ASE
- SAP Maxdb
- SAP Sqlanywhere
- Sqlite
- Sybase
- Plain Text
- Visual Foxpro

##### Other

- Feature Comparison Matrix
- Connection Matrix
- Include File Guide

v5:reference:connection:affected_rows

# affected_rows

##### Syntax

     mixed affected_rows()

## 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

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

    /*
     * connection assumed
     */
    $db->Execute('DELETE FROM act WHERE actno = 20');

    print $db->affected_rows();
    /*
     * Returns 1
     */

    $db->Execute('SELECT FROM act');
    print $db->affected_rows();
    /*
     * Returns false
     */

v5/reference/connection/affected_rows.txt · Last modified: 2016/01/16 13:39 by mnewnham

### Page Tools

- Show pagesource
- Old revisions
- Backlinks
- Rename Page
- Back to top