I am using lazy loading to load data from database to device the limit is 20 but my problem lies when I pull the data from table because I have to order it by latest next date.
eg. I pull all data for today then tommorrow and then so on I cant use the id to keep track of what I loaded becuase the entries have different dates when entered
this is and example of my table. please note that my table can have thousands of entries
| id | name | date | time | | 0 | name1 | 2018-09-30 | 01:00:00 | | 1 | name2 | 2019-01-10 | 15:30:00 | | 2 | name3 | 2019-09-30 | 10:20:00 | | 3 | name4 | 2018-05-20 | 14:10:00 | | 4 | name5 | 2020-09-02 | 01:30:00 | | 5 | name6 | 2018-10-30 | 14:00:00 |
this is what my sql php script looks like. I know its not right but its an example of what im triying to do
SELECT * FROM table WHERE date >= '$today' AND id >= '$lastId' ORDER BY date ASC LIMIT 20
as you can see the id increments but the dates dont increment because it can be entered with any future date. I apologize for my bad english. Please can anyone help me