I get the variable 'stock' from my database. I would like increment my variable with an update with this code:
$stock = $_POST['stock']
$nom = 'salade';
$req=("UPDATE ingredients SET stock=$stock+1 WHERE nom = :nom;");
$stmt = $db->prepare($req);
// execute the query
$stmt->execute(array('nom'=>$nom));
But the problem is that my variable increment by 8 and not by 1 because I have 8 element (salade,tomatoes, bread etc). I want to increment by 1 with UPDATE.
Thanks to reading me !
SET stock=stock + $stock
$stock = $_POST['stock'] + 1;