PDO clone a record then open cloned record to edit

26 views Asked by At

After a clone operation, I would like to open the cloned record for editing, which would be the last ID instead of going back to view all records. My current full code is...

if (isset($_GET['clone'])) {
    
    // clone the faqs
    $stmt = $pdo->prepare('INSERT INTO `faq`(`question`,`answer`,`category`,`date_added`,`date_edited`,`priority`,`status`,`editor`,`pagelink`) SELECT `question`,`answer`,`category`,`date_added`,`date_edited`,`priority`,`status`,`editor`,`pagelink` FROM `faq` WHERE id = ?');
    $stmt->execute([ $_GET['clone'] ]);
    header('Location: faqs.php?success_msg=4');
    exit;
}

Could anyone help please?

Thank you

0

There are 0 answers