function supprimerPanier($cnn, $idUtilisateur, $idProduit, $idCommande) { $nbElementPanier = countPanier($cnn, $idUtilisateur); $req = " DELETE FROM `ligne_commande` \n WHERE ID_PRODUIT =:idProduit\n AND ID_COMMANDE=:idCommande; "; if ($nbElementPanier == 1) { $req = $req . "\n DELETE FROM commande\n WHERE ID_COMMANDE=:idCommande;\n "; } $stmt = $cnn->prepare($req); $stmt->bindParam(':idProduit', $idProduit); $stmt->bindParam(':idCommande', $idCommande); $stmt->execute(); }
<h1><a href="accueil.php">Pimp<strong>Your Body</strong></a></h1> <nav> <div class="social-icons"> <?php if (Auth::islog()) { echo ' <a href="deconnexion.php"><span class="glyphicon glyphicon-off"></span>Déconnexion</a> '; } ?> </div> <div class="social-icons"> <?php $nbPanier = 0; if (isset($_SESSION['idUtilisateur'])) { $nbPanier = countPanier($connexion, $_SESSION['idUtilisateur']); } echo '<a href="panier.php"><span class="glyphicon glyphicon-shopping-cart"></span><span class="badge">' . $nbPanier . '</span></a>'; ?> <a href="connexion.php"><span class="glyphicon glyphicon-user"></span>Mon compte</a> </div> <ul class="menu"> <?php if (Auth::islog()) { echo ' <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Mon compte <span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="mon_objectif.php">Mon objectif</a></li>