Name
mysql_affected_rows( )
Synopsis
mysql_affected_rows([connection
])
This returns
the number of rows affected by a previous SQL statement that modified
rows of data for the current MySQL session. The function returns -1
if the previous statement failed. It works only after
INSERT
, UPDATE
, and
DELETE
statements. See mysql_num_rows(
)
for the number of rows returned by a
SELECT
statement. The connection identifier may be
given as an argument to retrieve the number of rows affected by a
different connection.
... $sql_stmnt = "UPDATE workreq SET due_date = ADDDATE(due_date, INTERVAL 1 DAY) WHERE due_date = '2004-07-28'"; mysql_query($sql_stmnt); $updated = mysql_affected_rows( ); print "Number of Rows Updated: $updated \n"; ...
This script changes the due dates for all work requests by one day.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.