Exemplo n.º 1
0
 public function getGroup($id = NULL)
 {
     if ($id) {
         $stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM group_product WHERE id= :id");
         $stmt->bindParam(':id', $id);
     } else {
         $stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM group_product");
     }
     try {
         $stmt->execute();
     } catch (Exception $e) {
         echo "Problem at " . $e->getLine() . " from model Extraction :" . $e->getMessage();
     }
     $stmt = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $result = array();
     foreach ($stmt as $group) {
         $group_ = new group_products();
         $group_->setId($group["id"]);
         $group_->setName($group["name"]);
         $group_->setType($group["type"]);
         array_push($result, $group_);
     }
     return $result;
 }
Exemplo n.º 2
0
<?php

require_once '../model/group_products.php';
$group_products = new group_products();
if ($_GET["name"] != "") {
    $group_products->setName($_GET["name"]);
    $group_products->setType($_GET["type"]);
    $group_products->addToDatabase();
}
header('location:' . $_GET["next"]);