Postingan lainnya
Error unknown column 'user' in 'where clause' code igniter
Gan Kira kira error kenapa ya padahal di database ada table user dan kolom email tapi ttp error kenapa ya ini SC nya : Ini error nya :
A Database Error Occurred
Error Number: 1054
Unknown column 'user' in 'where clause'
SELECT * FROM `user` WHERE `user` = 'salam@gmail.comda' LIMIT 1
Filename: D:/xampp2/htdocs/Client/system/database/DB_driver.php
Line Number: 691
private function _login()
{
$email = htmlspecialchars($this->input->post('email', true));
$password = $this->input->post('password', true);
$user = $this->db->get_where('user', ['email' => $email])->row_array();
//apabila user aktif
if ($user) {
if ($user['is_active'] == 1) {
//cek password
if (password_verify($password, $user['password'])) {
$data = [
'email' => $user['email'],
'role_id' => $user['role_id']
];
$this->session->set_userdata($data);
if ($user['role_id'] == 1) {
redirect('admin');
} else {
redirect('customer_service');
}
} else {
$this->session->set_flashdata('message', '<div class="alert alert-danger" role="alert">
Password Salah
</div>');
redirect('auth');
}
} else {
$this->session->set_flashdata('message', '<div class="alert alert-danger" role="alert">
Email Belum Terdaftar!
</div>');
redirect('auth');
}
}
}
Tanggapan
cek kolom user nya tulisan nya udah bener blm user, bkn users
2 Jawaban:
Jawaban Terpilih
karena di where clause nya yg kamu cek itu column user
<pre>
SELECT * FROM user
WHERE user
= 'salam@gmail.comda' LIMIT 1
//coba kamu ganti pakai email
SELECT * FROM user
WHERE email
= 'salam@gmail.comda' LIMIT 1
</pre>
Tanggapan
Coba deh om liat syntax nya
ka, untuk perbaikannya. itu biasa terletak di file mana ya? soalnya di File DB_DRIVERS baris 691 SELECT * FROM itu tidak ada.
<div class="attachment-gallery attachment-gallery--2"><figure data-trix-attachment="{"contentType":"image/png","filename":"Doc1_001.png","filesize":65612,"height":209,"url":"https://i.ibb.co/D4rbb94/Doc1-001.png","width":396}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/D4rbb94/Doc1-001.png" width="396" height="209"><figcaption class="attachment__caption"><span class="attachment__name">Doc1_001.png</span></figcaption></figure><figure data-trix-attachment="{"contentType":"image/png","filename":"Doc1,_001.png","filesize":30034,"height":249,"url":"https://i.ibb.co/0yYF7pf/Doc1-001.png","width":477}" data-trix-content-type="image/png" data-trix-attributes="{"presentation":"gallery"}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/0yYF7pf/Doc1-001.png" width="477" height="249"><figcaption class="attachment__caption"><span class="attachment__name">Doc1,_001.png</span></figcaption></figure></div><div>cara mengatasinya gimana mohon bantuannya</div>
Tanggapan
Kalo potongan kode sama keterangan errornya di screenshot itu kurang jelas, coba manfaatin fitur snipet code di forum ini, atau biar lebih rapih, agan bikin thread baru aja.