Essentially I would like create a query that checks if the posted code already exists, if the code value already exists in the Table1 run the following update query:
$stmt = $conn->prepare('UPDATE Table1
SET value = 2
WHERE code = :codeNumber');
$stmt->execute([
'codeNumber' => $_POST['code']
]);
If the code value does not exist run the following query:
$stmt = $conn->prepare( ' INSERT INTO `Table1` (`code`,`value`)
VALUES (:code, :value) ' );
$stmt->execute([
'code' => $_POST['code'],
'value' => $_POST['value']
]);
How can something like this be done?