I have a system from which take the current day schedule and the next schedule, see:
To get the current day’s schedule, I did it this way:
// DataAgenda = NOW()
mysqli_query($this-conexao,"SELECT * FROM agenda WHERE DATE(DataAgenda) = CURDATE()");
And the next event, how can I catch it?
1 answer
0
I was able to solve it this way:
mysqli_query($this-conexao,"SELECT * FROM agenda WHERE DATE(DataAgenda) > CURDATE() ORDER BY DataAgenda LIMIT 1");
1
If the record of the next event is before the current will go bad :D... In fact, if there is a record before it is at a later date than the next, it will return.
Don’t forget to add one order by DataAgenda. What Voce does is take the first record with the DATE(DataAgenda) > CURDATE(). That’s not going to be the next event.
If the record of the next event is before the current will go bad :D... In fact, if there is a record before it is at a later date than the next, it will return.
– Sam
Don’t forget to add one
order by DataAgenda
. What Voce does is take the first record with theDATE(DataAgenda) > CURDATE()
. That’s not going to be the next event.– William John Adam Trindade
Well noted William. Thank you.
– user24136
Sorry dvd, I couldn’t understand.
– user24136