I use PHP and MySQL.
If I use the INSERT ON DUPLICATE UPDATESQL statement, then how do I know if the last operation was a successful insert, and not an update or a failed insert?
INSERT ON DUPLICATE UPDATE
The assumptions in this table do not use auto-increment, so I cannot use mysql_insert_idto help me find out.
mysql_insert_id
You will need to check mysql_affected_rows (), which will return 1 on insert and 2 on update. According to mysql documentation .
if (mysql_affected_rows() == 1) //INSERT elseif (mysql_affected_row() == 2) //UPDATE
, 0.