I do not know why it returns the Call to a member function fetchAll() on a non-object
error because I am using the fetchAll method on the _sth object.
Does anybody know why it does this?
FormValidator PHP
$users = $this->_db->query("SELECT * FROM $ruleValue WHERE $input = ?", array($inputValue));
if($users->count()) {
$this->addError($input, $rule);
}
Method
public function query($sql, $params = array()) {
$this->_sth = $this->_dbh->prepare($sql);
if($this->_sth = $this->_sth->execute($params)) {
return $this->_sth->fetchAll(PDO::FETCH_OBJ);
}
return false;
}