sqlite_changes

SQLiteDatabase::changes

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

sqlite_changes -- SQLiteDatabase::changes Returns the number of rows that were changed by the most recent SQL statement

说明

sqlite_changes ( resource $dbhandle ) : int

面向对象风格 (method):

public SQLiteDatabase::changes ( void ) : int

Returns the numbers of rows that were changed by the most recent SQL statement executed against the dbhandle database handle.

参数

dbhandle

The SQLite Database resource; returned from sqlite_open() when used procedurally. This parameter is not required when using the object-oriented method.

返回值

Returns the number of changed rows.

范例

Example #1 过程化风格

<?php
$dbhandle 
sqlite_open('mysqlitedb');
$query sqlite_query($dbhandle"UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
if (!
$query) {
    exit(
'Error in query.');
} else {
    echo 
'Number of rows modified: 'sqlite_changes($dbhandle);
}
?>

Example #2 面向对象风格

<?php
$dbhandle 
= new SQLiteDatabase('mysqlitedb');
$query $dbhandle->query("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
if (!
$query) {
    exit(
'Error in query.');
} else {
    echo 
'Number of rows modified: '$dbhandle->changes();
}
?>

参见

  • sqlite_open() - Opens an SQLite database and create the database if it does not exist

相关文章
php eventutil returns the most recent socket error numberphp cubrid mysql 兼容性函数 return the number of rows affected by the last sql statementphp ibm db2 函数 returns the number of rows affected by an sql statementphp firebird/interbase 函数 return the number of rows that were affected by the previous queryphp maxdb 函数 returns the number of columns for the most recent queryphp maxdb 函数 returns the total number of rows changed deleted or inserted by the last executed statementphp maxdb 函数 returns the error code for the most recent statement callphp maxdb 函数 returns the number of parameter for the given statementphp msql 函数 returns number of affected rowsphp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp sqlite 函数 returns the number of fields in a result setphp sqlite 函数 returns the number of rows in a buffered result setphp sqlsrv 函数 returns the number of rows modified by the last insert update or delete query executedphp mysqli stmt returns the total number of rows changed deleted or inserted by the last executed statementphp mysqli stmt returns the error code for the most recent statement callphp mysqlnduhconnection returns the number of columns for the most recent queryphp sqlite3 returns the number of database rows that were changed or inserted or deleted by the most recent sql statementphp sqlite3 returns the numeric result code of the most recent failed sqlite requestphp sqlite3 returns english text describing the most recent failed sqlite requestphp sqlite3 returns the row id of the most recent insert into the database
关注编程学问公众号