-1
当我想创建一个帐户,以测试是否插入到数据库的工作我得到这个错误笨数据库错误1064
错误编号:1064 您的SQL语法错误;检查对应于您MariaDB的服务器版本的正确的语法使用手动接近 '其中0 = '在列测试' LIMIT 1' 2
SELECT * WHERE 0 = 'test' LIMIT 1
文件名:C:/ XAMPP/htdocs中/ STG /系统/数据库/ DB_driver.php
行号:691
我CONTROLER代码Main.php:
$data = array();
$userData = array();
if($this->input->post('insert')){
$this->form_validation->set_rules('username',
'username',
'trim|required|is_unique|min_length[6]|max_length[20]');
$this->form_validation->set_rules('password',
'password',
'trim|required|min_length[8]|max_length[20]|callback_is_password_strong');
$this->form_validation->set_rules('conf_password',
'confirm password',
'required|matches[password]');
$userData = array(
'username' => $this->input->post('username'),
'password' => $this->input->post('password')
);
if($this->form_validation->run() == true){
$insert = $this->login_model->insert($userData);
if($insert){
$this->session->set_userdata('success_msg',
'Your registration was successfully. Please login to your account.');
redirect('login');
}else{
$data['error_msg'] = 'Some problems occured, please try again.';
}
}
}
$data['user'] = $userData;
//load the view
$this->load->view('register', $data);
}
我的模型代码LOGIN_MODE l.php:
public function insert($data = array()){
//add created and modified data if not included
if(!array_key_exists("created", $data)){
$data['created'] = date("Y-m-d H:i:s");
}
if(!array_key_exists("modified", $data)){
$data['modified'] = date("Y-m-d H:i:s");
}
}
$insert = $this->db->insert('login' ,$data);
if($insert){
return $this->db->insert_id();
}else{
return false;
}
echo $insert;
}
笨什么版本的? – coderodour
3.1.5最新版本。 – Skully1
我只是单击提交按钮来插入用户到数据库,但我得到这个错误。 – Skully1