I am using REPLACE INTO
command for inserting/updating record in MySQL table. However I want to get ID of row which gets affected by REPLACE INTO
.
I used lastInsertId()
with INSERT INTO
but it is not useful over here because if my record already exists then by using lastInsertId()
with REPLACE INTO
, i'll get wrong ID.
So is there any function present in MySQL + php + PDO to get that id?