I am having an issue with this code:
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[4]|callback_user_check');
It is displaying the user_check
error even when the username field is empty; I was expecting the required error message.
function username() {
$query = "SELECT salt FROM user WHERE username = ?";
$get_query = $this->db->query($query, array($this->username));
if ($get_query->num_rows() > 0) {
$row = $get_query->row_array();
return $row['salt'];
} else {
return false;
}
}
Set validation custom message
$this->form_validation->set_message('username', 'Your message here');