public function ajoutez_un(Panier $panier) { $maquantite = $panier->getQuantiteart(); $plusun = 1; $requete = $this->_db->prepare('update panier set quantiteart=:quantiteart where id=:id'); $requete->execute(array(':quantiteart' => $maquantite + $plusun, ':id' => $panier->getIdpanier())); }
<?php /** * Created by PhpStorm. * User: Florent * Date: 12/03/2015 * Time: 08:48 */ require_once '../bdd/pdo.php'; require_once '../class/Article.php'; require_once '../manager/ArticleManager.php'; require_once '../manager/PanierManager.php'; require_once '../class/Panier.php'; session_start(); $monpanier = new Panier(); $monpaniermanager = new PanierManager($bdd); $id = $_POST['idpanier1']; $quantite = $_POST['quantitepanier']; $monpanier->setIdpanier($id); $monpanier->setQuantiteart($quantite); if ($monpanier->getQuantiteart() == 1) { $monpaniermanager->suppression_panier_ligne($monpanier); header('Location:../main/panier.php'); } else { $monpaniermanager->soustraction_un($monpanier); header('Location:../main/panier.php'); }