-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