I want to count user in database to login, what wrong whith my code
public function index(){
//validasi
$valid = $this->form_validation;
$valid->set_rules('username', ' Username', 'required',
array('required' => 'Username harus diisi'));
$valid->set_rules('password', 'Password', 'required|min_length[6]',
array('required' => 'password harus diisi',
'min_length' => 'Password minimal 6 karakter'));
if($valid->run()===FALSE){
//end validasi
$data = array('title' => 'Login Admin Tempat Ngaji');
$this->load->view('back-end/login_view', $data, FALSE);
//cek username dan password
}else{
$i = $this->input;
$username = $i->post('username');
$password = $i->post('password');
//cek di database
$check_login = $this->admin_model->login($username, $password);
//jika ada di db
//jika ada data 1
if(count($check_login) == 1) { `//row 40`
$this->session->set_userdata('username', $username);
$this->session->set_userdata('akses_level', $check_login->akses_level);
$this->session->set_userdata('id_admin', $check_login->id_admin);
$this->session->set_userdata('nama', $check_login->nama);
$this->session->set_userdata('status', $check_login->status);
redirect(base_url('admin/dashboard'), 'refresh');
}else{
//jika tidak cocok error
$this->session->set_flashdata('msg', 'Username atau password tidak cocok');
redirect(base_url('admin/login'), 'refresh');
}
function login
function login
public function login($username, $password){
$this->db->select('*');
$this->db->from('admin');
$this->db->where(array('username' => $username,
'password' => sha1($password)));
$query = $this->db->get();
return $query->row();
}
Looking for I saw that some have this error in their code, but I did not find anyone who received it in phpMyAdmin ...
What should I d