In my User
table I have phone
as unique. So when I insert duplicate phone number I want to update deviceId
, registrationId
and I want the id
which got updated. I tried this but its not working.
$stmt1 = $db->prepare("INSERT into User (name,phone, deviceId,registrationId) values(:name,:phone, :deviceId,:registrationId) ON DUPLICATE KEY UPDATE deviceId = :deviceId, registrationId = :registrationId, id=lastInsertId(id)");
Thank you..