1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| $sql = "UPDATE article SET stock_actuel=stock_actuel-? WHERE ref_produit=?";
$stock_alerte = "SELECT stock_alerte FROM article WHERE ref_produit=?";
$stock_actuel = "SELECT stock_actuel FROM article WHERE ref_produit=?";
$produit = "SELECT nom_produit FROM article WHERE ref_produit=?";
if ( $req->rowCount()!=0) {
$req = $pdo->prepare($sql);
$req->execute(array(
$_POST['quantite_sortie'],
$_POST['s_ref_produit']
));
if ( $req->rowCount()!=0) {
$Session = new Session();
$Session->setFlash('succès','success');
if ($stock_actuel <= $stock_alerte) {
mail(
'totototh@ààààà.com',
"Alerte stock {$produit}",
"Attention, le stock de {$produit} est bas {$stock_actuel}"
); |
Partager