The PHP function sqlite_changes()does this for you.
Returns the number of rows that were changed by the last SQL statement executed using the database descriptor dbhandle.
Call it either in a procedural style:
echo 'Number of rows modified: ', sqlite_changes($sqliteConnection);
or in the style of the object:
echo 'Number of rows modified: ', $sqliteConnection->changes();
source
share