PHP » GoLang |
login |
register |
about
|
GoLang mysql_affected_rows
request it (431)
GoLang replacement for PHP's mysql_affected_rows
[edit | history]
mysql_affected_rows(PHP 4, PHP 5) mysql_affected_rows — Get number of affected rows in previous MySQL operation Warning
This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide and related FAQ for more information. Alternatives to this function include: Description
int mysql_affected_rows
([ resource
$link_identifier = NULL
] )
Get the number of affected rows by the last INSERT, UPDATE, REPLACE
or DELETE query associated with Parameters
Return ValuesReturns the number of affected rows on success, and -1 if the last query failed. If the last query was a DELETE query with no WHERE clause, all of the records will have been deleted from the table but this function will return zero with MySQL versions prior to 4.1.2. When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that mysql_affected_rows() may not actually equal the number of rows matched, only the number of rows that were literally affected by the query. The REPLACE statement first deletes the record with the same primary key and then inserts the new record. This function returns the number of deleted records plus the number of inserted records. In the case of "INSERT ... ON DUPLICATE KEY UPDATE" queries, the return value will be 1 if an insert was performed, or 2 for an update of an existing row. Examples
Example #1 mysql_affected_rows() example
<?php The above example will output something similar to: Records deleted: 10 Records deleted: 0
Example #2 mysql_affected_rows() example using transactions
<?php The above example will output something similar to: Updated Records: 10 Notes
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|