It never works. And when I do a var dump on the sql query I see that the question marks are still in it. Which means that the values have not been binded right?
I don't understand why it's not binding the values.
Can anybody help me out?
PHP
$ruleValue = "value1";
$input = "value2";
$inputValue = "value3";
$this->_db->query('SELECT * FROM ? WHERE ? = ?', array($ruleValue, $input, $inputValue));
Method
public function query($sql, $params = array()) {
$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()) {
$this->_results = $this->_query->fetchAll(PDO::FETCH_OBJ);
$this->_count = $this->_query->rowCount();
} else {
$this->_error = true;
}
var_dump($this->_query);
}
return $this;
}
var_dump
object(PDOStatement)#5 (1) { ["queryString"]=> string(27) "SELECT * FROM ? WHERE ? = ?" }