我在绑定多个值时遇到问题。我已经尝试了一个值,它工作正常。有什么我想念的吗?
当我运行查询时,它给了我一个错误:警告:PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in C:\xampp\htdocs\Media\admin第 35 行的 \dashboard\classes\DB.php
private function runQuery($sql, $bind_value = array()) {
$this->_error = false;
if($ms = $this->_query = $this->_pdo->prepare($sql)) {
$this->_query->bindValue($x, $bind_values);
if($this->_query->execute()) { //**ERROR FOUND HERE**
echo 'ok';
}
die();
}
}
public function get($column, $table, $where = array()) {
if($where) {
if(count($where) === 3) {
$operators = array(
'=',
'<',
'>',
'>=',
'<='
);
$field = $where[0];
$operator = $where[1];
$value = $where[2];
$bind_value = array(
$column,
$table,
$field,
$operator,
$value,
);
if(in_array($operator, $operators)) {
$sql = "SELECT ? ? WHERE ? ? ?";
return $this->runQuery($sql, $bind_value);
}
} else {
echo 'problem';
}
}
}