Ejemplo n.º 1
0
 public function getLignesCommande($idCommande)
 {
     $sql = "\n                SELECT a_designation, a_pht, qte_cmde ,t_taux, a_quantite_stock, url_image  \n                FROM tb_article, tb_ligne_commande, tb_commande,tb_tva \n                WHERE tb_article.id_article = tb_ligne_commande.id_article\n                AND tb_ligne_commande.id_commande = tb_commande.id_commande\n                AND tb_tva.id_tva = tb_article.id_tva\n                AND tb_ligne_commande.id_commande = " . $idCommande;
     $i = ConnexionPDO::getInstance();
     $req = $i->prepare($sql);
     $req->execute();
     $resultat = "";
     while ($ligne = $req->fetch()) {
         $designation = $ligne[0];
         $pht = $ligne[1];
         $quantiteCommandee = $ligne[2];
         $taux = $ligne[3];
         $quantiteEnStock = $ligne[4];
         $urlImage = $ligne[5];
         $resultat .= '<tr>
                             <td>' . $designation . '</td>
                             <td>' . $pht . '</td>
                             <td>' . $quantiteCommandee . '</td>
                             <td>' . $taux . '</td>
                             <td>' . $quantiteEnStock . '</td>
                             <td>' . $urlImage . '</td>
                         </tr>';
     }
     return $resultat;
 }
Ejemplo n.º 2
0
 private function __construct()
 {
     try {
         self::$instance = new PDO('mysql:host=' . $this->host . ';dbname=' . $this->db . ';charset=utf8', $this->login, $this->pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
     } catch (Exception $e) {
         die('Erreur : ' . $e->getMessage());
     }
     return self::$instance;
 }
Ejemplo n.º 3
0
 /**
  * Obtention de l'historique des commandes pour un client donn�
  * @param int $idClient
  * @return int id_commande
  */
 public function getHistoriqueClient($idClient)
 {
     $sql = "SELECT id_commande " . "FROM `tb_commande` " . "WHERE client_id_pers = '{$idClient}' ";
     $pdo = ConnexionPDO::getInstance();
     $result = $pdo->query($sql);
     return $result->fetch();
 }
Ejemplo n.º 4
0
 /** Récupère les lignes de commande liées à une commande donnée.
  * 
  * @return array<int>   les identifiants des lignes de commande
  */
 public function getLignesCommande()
 {
     $i = ConnexionPDO::getInstance();
     return $i->getLignesCommandes($this->idCommande);
 }
Ejemplo n.º 5
0
 public function authentifierClient($password, $mail)
 {
     $userPassword = ConnexionPDO::getInstance()->getUserPassword($mail);
     if ($userPassword === $password) {
         if ((new Commande())->checkCookie() == true) {
             $id = ConnexionPDO::getInstance()->getIdPersonne($mail);
             // reccupere la valeur du cookie et lui ajoute l'id dans l'array 'id = $id'
         } else {
             (new Commande())->createCookie();
         }
     } else {
         echo 'Erreur d\'identification, veuillez recommencer';
     }
 }