Witam! Chciałbym poprosić o radę, czy jest sens robienia takich metod w klasie DATABASE? Czy warto zrobić to w inny sposób?
EX:
public function query($sql, $params = array(), $fetch = null, $fetchMode = PDO::FETCH_OBJ) {
$this->_error = false;
if($this->_query = $this->_pdo->prepare($sql)) {
$x = 1;
if(count($params)) {
foreach($params as $param) {
$this->_query->bindValue($x, $param);
$x++;
}
}
if($this->_query->execute()) {
if($fetch) {
$this->_results = $this->_query->fetchAll($fetchMode);
$this->_count = $this->_query->rowCount();
}
} else {
$this->_error = true;
}
}
return $this;
}