Modules/MTA-MySQL/mysql affected rows: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ Returns the number of changed rows (for UPDATE), inserted rows (for INSERT) or deleted rows (for DELETE) in the last query. For SELECT statements it works like [[Modules/MTA-MySQ...)
 
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{ModuleFunction|MTA-MySQL}}
Returns the number of changed rows (for UPDATE), inserted rows (for INSERT) or deleted rows (for DELETE) in the last query. For SELECT statements it works like [[Modules/MTA-MySQL/mysql_num_rows|mysql_num_rows]].
Returns the number of changed rows (for UPDATE), inserted rows (for INSERT) or deleted rows (for DELETE) in the last query. For SELECT statements it works like [[Modules/MTA-MySQL/mysql_num_rows|mysql_num_rows]].



Revision as of 17:59, 14 January 2008


Package-x-generic.png This function is provided by the external module MTA-MySQL. You must install this module to use this function.

Returns the number of changed rows (for UPDATE), inserted rows (for INSERT) or deleted rows (for DELETE) in the last query. For SELECT statements it works like mysql_num_rows.

Syntax

int mysql_affected_rows ( MySQLConnection handler )

Required arguments

  • handler: A valid MySQL link

Returns

The number of affected rows in the last query.

Example

Example 1: This example shows the number of deleted rows after deleting all accounts starting with 'A'

mysql_query(handler, "DELETE FROM account WHERE name LIKE 'A%'")
outputDebugString("We deleted a total of " .. mysql_affected_rows(handle) .. " accounts starting with 'A'")

See also