I have to following code to move a particular row to another table.
$id = $_GET['id'];
$table = $_GET['name'];
$trashtable = $_GET['name'] . "_trash";
$movetotable = $conn->prepare("INSERT INTO `$table` SELECT * FROM `$trashtable` WHERE id = :id");
$movetotable->bindParam(':id', $id, PDO::PARAM_STR);
$movetotable->execute();
If the primary key of this particular row already exists it throws ofcourse a duplicate entry error.
I would like to add the row with the duplicate primary key as a new row with a new id.
Is this possible? Hope to hear something soon!