Just learning how to work with php and mysql, using CodeIgniter. Running into that error.
I am attempted to check login attempts against my database, where they are stored. Here are the related functions in my login model:
public function verify_user($email, $password)
{
$q = $this
->db
->where('email_address', $email)
->where('password', $password)
->limit(1)
->get('users');
if ($q->num_rows > 0)
return $q->row();
}
add_login_attempt($email);
return false;
}
public function add_login_attempt($email)
{
$current_attempts = get_login_attempts($email);
if ($current_attempts > 2)
{
lock_account($email);
}
else
{
$updated_attempts = $current_attempts + 1;
$data = array('login_attempts' => $updated_attempts);
$this->db->where('email_address', $email);
$this->db->update('crm', $data);
}
}
function reset_login_attempts($email)
{
}
function lock_account($email)
{
}
public function get_login_attempts($email)
{
$this->db->select('login_attempts');
$this->db->from('crm');
$this->db->where('email_address', $email);
$login_attempts = $this->db->get();
return $login_attempts;
}
}
Logging in using correct credentials works no problem. When an incorrect password is entered, that error is encountered. Any help is greatly appreciated.
You have a syntax error :
Should be:
You forgot the
{