0
I have a table where I have 2 fields horainicio and horaafinal I’m wanting to get the results that fits between the initial and final values but unsuccessfully follow what I’m using.
I’m taking the current time and trying to make this comparison
$horaatual = date("H:i");
SELECT * FROM programacao WHERE horafinal => '$horaatual' ORDER BY Nid DESC LIMIT 1";
any suggestions? changed the code
In what format is the horainicio field?
– Amanda Lima
Already tried ?
– Marconi
the field is empty where it is registered as follows in text 11:15 , 15:25 etc
– Arsom Nolasco
Do you register one hour for records? or several hours in the same?
– Marco Souza
registration by registration and a system of programming of talkers EX: ID 1 name= so-called time=12:00 ID2 name=Ciclano time=15:00
– Arsom Nolasco
@Marconi now tried to Utulizar the betwenn however did not return results
– Arsom Nolasco
@Arsomnolasco here has a question well self Explanatory. Could you edit one and put in the similar model? I say structure, data and expected results
– Marconi
Already tried to convert the field
varchar
for team using thehour()
?'{$horaatual}' BETWEEN HOUR(horainicio) AND HOUR(horafinal)
?– William Novak
@Arsomnolasco has succeeded?
– Marconi
no results either
– Arsom Nolasco
Have you considered changing your fields to a date type? It’s much easier to work with.
– Jorge B.