I have two columns into mysql table map 1. First column have name json, second have name user_id
Now, I need to insert data to new row if user_id does not exist into mysql table, but if excist I need just to update json column where user_id = user_id ...
I try:
     try {        
                $STH = $db->prepare("INSERT INTO map (user_id, json)
VALUES (:2,:1)
on duplicate key update json=values(json)");
                $STH->bindParam(':1', $_POST['mapData']);
                $STH->bindParam(':2', $user_id);
Some ideas? I use php pdo.
How to solve this problem?
Thanks!