i'm using CodeIgniter (http://codeigniter.com/) and have a problem with an query:
select *
from mb_login_attempts
where ip_adress_hash = ?
and DATE_ADD(attempt_date,INTERVAL 30 MINUTE) > NOW()
i would like to use the following syntax:
$this->db->where('ip_adress_hash', $this->encrypt->sha1($this->input->ip_address()));
$this->db->where('DATE_ADD(attempt_date,INTERVAL 30 MINUTE) >','NOW()',TRUE);
if($this->db->count_all_results('mb_login_attempts') >= 3) {
return true;
}
If i use this code:
$sql = "select *
from mb_login_attempts
where ip_adress_hash = ?
and DATE_ADD(attempt_date,INTERVAL 30 MINUTE) > NOW()";
$val = $this->db->query($sql,$this->encrypt->sha1($this->input->ip_address()));
if($val->num_rows() >= 3) {
return true;
}
Does anyone have an idea how i get the first code get working correct? Edit: i have change some code to the comments - but it still doesn't work ...
regards ...