예제 #1
0
 public function getFromDatabase()
 {
     $stmt_get = $this->pdo->PDOInstance->prepare("SELECT * FROM group_product WHERE id = :id");
     $stmt_get->bindParam(':id', $this->id);
     try {
         $stmt_get->execute();
     } catch (Exception $e) {
         echo "Problem at " . $e->getLine() . " from model group_product :" . $e->getMessage();
     }
     if ($stmt_get->rowcount() != 0) {
         $stmt_get = $stmt_get->fetch(PDO::FETCH_ASSOC);
         foreach ($stmt_get as $key => $value) {
             $this->{$key} = $value;
         }
         $extraction = new extraction();
         $this->parameters = $extraction->getParametersFromType($this->type);
         return true;
     } else {
         return false;
     }
 }