I have a table for events/parties that store the day, month, year, hour, and minute in different fields for each event, in this way:
+--------+-----+-------+--------+--------+----------+
| event | day | month | year | hour | minute |
+--------+-----+-------+--------+--------+----------+
| event1 | 2 | 12 | 2015 | 11 | 25 |
| event2 | 3 | 1 | 2016 | 12 | 30 |
| event3 | 4 | 2 | 2016 | 13 | 45 |
+--------+-----+-------+--------+--------+----------+
Using this structure I can do a query for the exact current time in this way:
SELECT * FROM of2ab_jcalpro_events
WHERE day = " . date("j") . "
AND month = " . date("n") . "
AND year = " . date("Y") . "
AND hour = " . date("G") . "
AND minute = " . date("i") . "
ORDER by minute ASC
LIMIT 0,3
Now... My problem is how do I select the next three events? I mean from right now the next 3 events? It would be easy if I have a datetime, but I can not change the table structure and this is what I have, any idea?
Let put these values as example:
date("j") = 2
date("n") = 12
date("Y") = 2015
date("G") = 20
date("i") = 45
This mean: 2015-12-02 20:45
So, how to get the next rows after right now?