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\';
$
Considering that you're saying all you need to is increment by 1 each row WHERE nom = :nom
(I guess your actual code isn't wrong with $ instead of : or it wouldn't even "increment by 8" as you said you're already achieving... remember do edit this on your question, please):
UPDATE
ingredients
SET
stock=stock+1
WHERE
nom = :nom;
Jusk pick what you already had and add 1 stock=stock+1
.
You can use like this for variable in text query.
$req= ("UPDATE ingredients SET stock='".($stock+1)."' WHERE nom = :nom;");