I have an email that gets sent out (via PHPMailer) when a new user is added to a database. The DB is updated if the email (key) already exists with the ON DUPLICATE KEY UPDATE f
As per the docs: https://dev.mysql.com/doc/refman/5.1/en/mysql-affected-rows.html
For INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows value is 1 if the row is inserted as a new row and 2 if an existing row is updated.
So, use: mysql_affected_rows, or whatever equivalent is on your non-deprecated/non-obsolete DB library of choice.