In MYSQL i have DATE and TIME seperated. I need to count how many times one ip failed to login in the last 2 hours. If he failed too many times, then he can’t login for the next 2 hours.
I just don’t know which statement is the correct one (maybe none of the 2 below).
SELECT COUNT(`ip`) AS count_failed_logins FROM `failed_logins` WHERE `time`=TIME(CURTIME()+Interval 2 hour)
or
SELECT COUNT(`ip`) AS count_failed_logins FROM `failed_logins` WHERE `time`=TIMEDIFF(CURTIME()+Interval 2 hour)
You can simply do :