Can someone tell me, in this query how to do the echo if the quantity is more than stock?
$updatequery =
"UPDATE products SET
stock =
CASE WHEN stock >= '$quantity' THEN
(stock-'$quantity')
ELSE
stock
END
WHERE product = '$product' " ;
I tried something like this but it doesn't work!
if (!$updatequery) {
echo " We are sorry! The available stock of selected product ($stock units) in not enough ";
} else {
echo "Hello $username! You ordered $product with quantity: $stock succesfully";
}