CodeIgniter(http://codeigniter.com/)を使用していますが、クエリに問題があります。
select *
from mb_login_attempts
where ip_adress_hash = ?
and DATE_ADD(attempt_date,INTERVAL 30 MINUTE) > NOW()
次の構文を使用したいと思います。
$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;
}
このコードを使用する場合:
$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;
}
誰かが最初のコードを正しく機能させる方法を知っていますか?編集:私はいくつかのコードをコメントに変更しました-しかしそれはまだ機能しません...
よろしく...