[eluser]MMCCQQ[/eluser]
hi!
i got some doubts. about validation Library.
this is my login function
Code:
function Login()
{
$rules['username'] = "required";
$rules['password'] = "required";
$this->validation->set_rules($rules);
$fields['username'] = 'Username';
$fields['password'] = 'Password';
$this->validation->set_fields($fields);
if ($this->validation->run() == FALSE)
{
$this->_run('account/login_view');
}
else
{
$this->db->where('username', $_POST['username']);
$this->db->where('password', $_POST['password']);
$query =$this->db->get('member');
if ($query->num_rows() > 0){
$row = $query->row();
$data = array(
'username' => $_POST['username'],
'id' => $row->id,
'logged_in' => TRUE
);
$this->session->set_userdata($data);
redirect('../home/');
}else{
$this->_run('account/login_view');
}
}
}
i wanna send a Custom Msg when Username and Password dont match. how can i do this?
i added this
Code:
$this->validation->set_message('macth', 'Username and password don macth');
but dont work!
how?