代码返回:
Notice: Undefined offset: 0 line 60
Notice: Undefined offset: 1 line 61
Notice: Undefined offset: 2 line 62
返回应为:
"INSERT INTO users ('username', 'password', 'salt')"
我不知道哪里出了错。我不知道,所以我需要一些帮助。
部分代码如下:
private function action($action, $table, $where = array()) {
if(count($where) === 3) {
$operators = array('=','>','<','>=' ,'<=');
$field = $where[0]; -----> LINE 60
$operator = $where[1]; -----> LINE 61
$value = $where[2]; -----> LINE 62
if(in_array($operator, $operators)) {
$sql = "{$action} FROM {$table} WHERE {$field} {$operator} ?";
if(!$this->query($sql, array($value))->error()) {
return $this;
}
}
}
return false;
}