[eluser]David Johansson[/eluser]
You are very close.
First, you have to decide which field to apply the rule on. Lets say you apply the rule on the email field, then you should write:
Code:
array(
'field' => 'email',
'label' => 'Email',
'rules' => 'callback__in_db[password]'
//does SELECT COUNT(*) FROM tbl WHERE email = 'field_email'
)
and your function _in_db could look something like:
Code:
function _in_db($email, $password_field)
{
$password = $this->input->post($password_field);
//Then you make your db query and return true if the result is one otherwise false
}
If you are using the build in error messages you should do something like:
Code:
$this->form_validation->set_message('_in_db', 'Wrong %s or %s.');
which would produce something like "Wrong Email or Password".