mardi 20 juin 2017

UPDATE table and SET column based on condition

This is how my code looks now:

$stmt = $link->prepare("UPDATE product SET product_price_lowest = $adPrice WHERE product_id = $prodId");
$stmt->execute();


I want to SET product_price_lowest TO $adPrice only:
IF $adPrice < product_price_lowest


How can I do this?

Aucun commentaire:

Enregistrer un commentaire