I made the code below and it works, the check is done if the date is contained between the two columns and returns the result.:
SELECT * FROM 'ips_bloqueados'
WHERE ip = '::1' AND '2015-04-18' BETWEEN date(inicio) AND date(fim)
But I would like to implement it for Date and Time, I want it to return if the date and time is contained between the two columns, but I am not getting it, the code does not return any results, however it was to return:
SELECT * FROM 'ips_bloqueados'
WHERE ip = '::1' AND '2015-04-18 14:10:00' BETWEEN date(inicio) AND date(fim)
Code Up Returns 0 Records Found
But look at the structure of the database:
id_bloqueio ip inicio fim
20 '::1' '2015-04-19 14:02:42' '2015-04-19 14:17:42'
19 '::1' '2015-04-18 14:02:27' '2015-04-18 14:17:27'
18 '::1' '2015-04-18 14:02:19' '2015-04-18 14:17:19'
17 '::1' '2015-04-18 14:01:47' '2015-04-18 14:16:47'
16 '::1' '2015-04-18 14:01:46' '2015-04-18 14:16:46'