$user = $this->db->get('products', ['email','=', $email]);
object(Database)#2 (5) { ["pdo":"Database":private]=> object(PDO)#3 (0) { } ["query":"Database":private]=> object(PDOStatement)#5 (1) { ["queryString"]=> string(38) "SELECT * FROM products WHERE email = ?" } ["error":"Database":private]=> bool(false) ["results":"Database":private]=> array(1) { [0]=> object(stdClass)#6 (4) { ["id"]=> string(2) "16" ["email"]=> string(12) "danu@mail.ru" ["name"]=> string(4) "Danu" ["password"]=> string(60) "$2y$10$plpesxMMJyty6PGqWWkQJefV.tSWAUD.r9rMq6/MYIFUwQfj1jWeq" } } ["count":"Database":private]=> int(1) }
public function action($action, $table, $where){
if (count($where) === 3){
$operators = ['=', '>', '<', '<=', '>='];
$field = $where[0];
$operator = $where[1];
$value = $where[2];
if (in_array($operator, $operators)){
$sql = "{$action} * FROM {$table} WHERE {$field} {$operator} ?";
if ( !$this->query($sql, [$value])->showError() ){
return $this->results;
}
}
}
}