我得到這個錯誤:PHP如何編碼(轉義)@,用於電子郵件驗證?
Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com' at line 1
下面的代碼:
$email = $this->input->post('email');
$checkEmail = $this->crud_model->retrieve_where('employee', 'email', 'email', $email);
crud_model:
function retrieve_where($table, $table_id, $table_name, $value) {
$table = $this->db->query('Select * FROM ' . $table . ' Where ' . $table_id . ' = ' . $value);
$records = array();
foreach ($table->result() as $row) {
$records[] = $row->$table_name;
}
return $records;
}
基本上用''來包含你的值選擇* FROM employee where email ='[email protected]' – ITroubs 2013-03-18 13:19:07
引用字符串:'select * FROM employee Where email ='b @ gmail.com''你不顯示你的retieve_where()做了什麼,但是我堅持它不使用預準備語句,或者正確引用字符串 – 2013-03-18 13:20:10
引號去哪裏? $ this-> crud_model-> retrieve_where('employee','email','email',$ email); – Waygood 2013-03-18 13:21:04