I am working on a project where i have somewhere to collect and save from facebook user data in db from different sources and i have to update user data if he already exist.
for now, i am saving the facebook_user_id as unique key in a different extra table to be sure that it s the first time the user was detected, and then make some things if it s the first detection.
if($dbh->query()) then ...
then i have to update user data and get its db id for further uses.
$sql = INSERT into users ...
ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), ...
$uid = LAST_INSERT_ID
So what i need is a solution where i can update the user data and detect if insered for the first time or updated by not using the extra table.