BD Search in more than one column, PDO OOP

0

Good afternoon, I have these two methods below, they work normally, but I can only do the search in a table column, but I need to do in more than one, I tried to use two-dimensional array, but without success. Would anyone have any tips on how to do this?

public function get($table, $where){
    return $this->action('SELECT *', $table, $where);
}
public function action($action, $table, $where = array()){
    if (count($where) === 3) {
        $operators = array('=','>','<','>=','<=');

        $field = $where[0];
        $operator = $where[1];
        $value = $where[2];

        if (in_array($operator, $operators)) {
            $sql = "{$action} FROM {$table} WHERE {$field} {$operator} ?";
            echo $sql;
            if (!$this->query($sql, array($value))->error()) {
                return $this;
            }
        }
    }
    return false;
}
    
asked by anonymous 06.02.2018 / 20:10

0 answers