I have a problem with my incrementation in php.
I try to add a button "+" who add +1 when I Click on the button for my ingredients.
So for example, If I click on + for "tomatoes" and If in my database I had 50 tomatoes. Now I have 51 tomatoes
I did it, but the problem is that when I click on "+", it add me not +1 but +8 ( Maybe because I have 8 ingredients in my database)
Here my code :
$nom = 'salade';
$req=$db->prepare("UPDATE ingredients SET stock = stock +1 WHERE nom =:nom");
$req->execute(array('nom' =>$nom));
Thanks for reading me !