0
I am creating a mysql table containing the date of an event. The question is as follows: if on the present day there is an event it is highlighted otherwise indicates the day of the next event. would they have any idea how to do it? The query for the current day would be more like searching for the following if it does not have the current day.
$data_atual = date('Y-m-d');
$resultado_evento = mysql_query("SELECT * FROM agenda WHERE data like '%$data_atual%'");
while($linhas_evento = mysql_fetch_array($resultado_evento)) {
echo "nome " . $linhas_evento['nome'] . "<br>";
}
vlw fall by the help, I’m starting php so sometimes I get lost with these selects but it worked right. hugs
– Alexandre
Legal @Alexandre mark as the right answer here!
– caiocafardo
At first I thought it worked out but do not know the pq, I’m using datatime more type have a first field 2016-09-01 14:00 and a second 2016-09-01 16:00 more passing the time of 14 hrs or more he continues reading the first field and does not pass to the following which would be the 16 hrs tenntei use the condition if more still continues reading only the first field.
– Alexandre
Something else is wrong with my code, not the call, I isolated it on another page and it worked correctly. I’ll check if I didn’t duplicate some variable that conflicted
– Alexandre
@Alexandre in $data_actual you need to put the time then, this check I did was only with the day. I edited the answer
– caiocafardo
in select I left an Hour(date) >= $hours so it selects only from the current time and if in the next event of the following day it should be presented if there was no other event on the current day and the time is less than in select it is cancelled until the next day. would be able to leave Hour(date) > 00:00:00 ? and what would be the syntax used in the case?
– Alexandre