0
我遇到綁定多個值的問題。我已經嘗試過一個值,它工作正常。有什麼我錯過了嗎?PHP綁定值
當我運行查詢它給了我一個錯誤: 警告:PDOStatement :: execute():SQLSTATE [HY093]:無效的參數號:綁定變量的數量不匹配C:\ xampp \ htdocs \ Media \ admin \ dashboard \ classes \ DB.php on line 35
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';
}
}
}