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 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 ibm db2 函数 returns a string containing the sqlstate returned by an sql statementphp ibm db2 函数 returns a string containing the last sql statement error messagephp frontbase 函数 get the number of rows affected by the last statementphp firebird/interbase 函数 return the number of rows that were affected by the previous queryphp maxdb 函数 returns the error code for the most recent function callphp 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 msql 函数 returns number of affected rowsphp oci8 函数 returns the next child statement resource from a parent statement resource that has oracle database 12c implicit result setsphp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp sqlite 函数 returns the rowid of the most recently inserted rowphp 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 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 sqlite3stmt returns the number of parameters within the prepared statement
关注编程学问公众号