Example #1
0
 public static function deleteOrder($id)
 {
     PDOConnexion::setParameters('phonedeals', 'root', 'root');
     $db = PDOConnexion::getInstance();
     $sql = 'DELETE FROM orders WHERE id = :id';
     $sth = $db->prepare($sql);
     $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Order');
     $sth->execute(array(':id' => $id));
 }
Example #2
0
 public static function getBrandList()
 {
     PDOConnexion::setParameters('phonedeals', 'root', 'root');
     $db = PDOConnexion::getInstance();
     $sql = 'SELECT * FROM brand';
     $sth = $db->prepare($sql);
     $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Brand');
     $sth->execute();
     return $sth->fetchAll();
 }
Example #3
0
<?php

if (isset($_GET['id']) && !empty($_GET['id'])) {
    $id = htmlentities($_GET['id']);
    $promotion = Promotion::getPromotionById($id);
    if (isset($_POST['edit'])) {
        if (preg_match("#^([0-9]{1,2}|100)\$#", $_POST['percent'])) {
            PDOConnexion::setParameters('phonedeals', 'root', 'root');
            $db = PDOConnexion::getInstance();
            $sql = "\n\t\t\t\tUPDATE promotion\n\t\t\t\tSET percent = :percent\n\t\t\t\tWHERE id = :id\n\t\t\t";
            $sth = $db->prepare($sql);
            $sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Promotion');
            $sth->execute(array(':id' => $id, ':percent' => $_POST['percent']));
            if ($sth) {
                App::success('La promotion a bien été modifiée');
            }
        } else {
            App::error("Les champs ne sont pas valides");
        }
    }
    if ($member) {
        ?>
<div class="col-md-8">
    <div class="page-header">
        <h1>Éditer une promotion</h1>
    </div>

    <form action="index.php?page=admin/promotion-edit&amp;id=<?php 
        echo $id;
        ?>
" method="POST">
Example #4
0
 public static function setParameters($_dbname, $_user, $_pwd)
 {
     self::$dbname = $_dbname;
     self::$user = $_user;
     self::$pwd = $_pwd;
 }