You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ADO Harbour
Hola Antonio,
SELECT ROW_COUNT()
De acuerdo con preguntar en el navegador
In MySQL, the number of affected rows by the last INSERT, UPDATE, or DELETE statement can be retrieved using the ROW_COUNT() function. This function returns the number of rows that were actually changed by the preceding statement.
For example, to get the number of rows affected by an UPDATE statement:
Código
UPDATE your_table SET column_name = 'new_value'WHERE condition; SELECT ROW_COUNT();
Important Considerations:
ROW_COUNT() should be called immediately after the INSERT, UPDATE, or DELETE statement to ensure it reflects the correct operation.
For UPDATE statements, ROW_COUNT() returns the number of rows where the new value is different from the old value. If a row's value is updated to the same value it already had, it is typically not counted as an "affected" row by default.
For REPLACE statements, ROW_COUNT() returns 2 if an old row was deleted and a new one inserted, or 1 if a new row was inserted without replacing an old one.
For INSERT ... ON DUPLICATE KEY UPDATE statements, ROW_COUNT() returns 1 for a new insertion, 2 for an update of an existing row, and 0 if an existing row is set to its current values (unless CLIENT_FOUND_ROWS is used, in which case it returns 1 for the latter case).
ROW_COUNT() does not account for rows implicitly affected by cascading foreign key actions (e.g., ON DELETE CASCADE).
For SELECT statements, ROW_COUNT() behaves similarly to mysql_num_rows(), returning the number of rows retrieved.
Antonio Vázquez
unread,
Sep 4, 2025, 4:02:38 PM (4 days ago) Sep 4
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message