Hi all,
With this code im trying to see wether the row exists by matching the session id, and if it exists update but if it doesn’t, it inserts the row…
if($_GET['email_quote']) {
$a = session_id();
$quote1 = $_GET['quote1'];
$data = [
'id' => $a,
'quote_picked' => $quote1
];
$sql = "IF EXISTS (SELECT * FROM final_quote WHERE quote_id=:id) UPDATE final_quote SET quote_picked=:quote_picked WHERE quote_id=:id ELSE
INSERT INTO final_quote (quote_id, quote_picked) VALUES (:quote_id, :quote_picked)";
$stmt= $link->prepare($sql);
$stmt->execute($data);
}
And my brain is fried…any pointers will be appreciated.
Thank you.