function exec($one = false) { $bdd = Database::getInstance(); $query = 'SELECT ' . join(', ', $this->fields) . ' FROM ' . $this->table . ' WHERE ' . $this->where . (!empty($this->orderby) ? ' ORDER BY ' . $this->orderby . ($this->isAsc ? ' ASC' : ' DESC') : '') . (count($this->limit) != 0 ? ' LIMIT ' . $this->limit[0] . ', ' . $this->limit[1] : ''); $req = $bdd->query($query); $buffer = $one ? $req->fetch(PDO::FETCH_BOTH) : $req->fetchAll(PDO::FETCH_ASSOC); if ($this->debug) { var_dump($buffer, $query, $req->errorInfo()); } $req->closeCursor(); return $buffer; }
function __construct() { $this->dtb = Database::getInstance(); }