I have a problem that I do not know how to solve.

I have a database with a table of flights, which has various attributes, including "departure_time". if the user wants to buy today's ticket, then he will display only those flights that have not yet made. for example: I enter the direction of Rome-London, today there are flights at 10 am and 10 pm, and now it's 3 pm, of course, I can't fly on a flight that was 5 hours ago, and that is, this flight won't show me, but I can fly in 7 hours and this flight will show me. in general, I don’t know how to send a request to the database so that it compares the current time with the time of sending the aircraft and displays only available flights.

I will be grateful for any help! <input class="currentTime" type="hidden" name="time"> var now = new Date(); var time = now.getHours() + ':' + (now.getMinutes()<10?'0':'') + now.getMinutes(); $cutime = $_REQUEST['time']; $queryResult = mysql_query("SELECT * FROM <input class="currentTime" type="hidden" name="time"> var now = new Date(); var time = now.getHours() + ':' + (now.getMinutes()<10?'0':'') + now.getMinutes(); $cutime = $_REQUEST['time']; $queryResult = mysql_query("SELECT * FROM flights WHERE //дальше не знаю что именно прописать");
WHERE //дальше не знаю что именно прописать");

  • And a column with dates, what specific type? - user205867
  • @ Otis666 time time, but I have no specific dates in the database. I have days of flight week. choosing a date in the calendar, I immediately translate it on the day and send it by request as the day of the week - Oblivion
  • now.getMinutes () <10? '0': '' what is this code for? - user205867
  • your js-code does not give the correct time, it should be so, var time = now.getHours () + ":" + now.getMinutes () + ":" + now.getSeconds (); - user205867
  • @ Otis666 seconds is not so important, so I do not specify them. "now.getMinutes () <10? '0'" so that the minutes show like this: 15:08, not 15: 8 - Oblivion

1 answer 1

Try this

 SELECT * FROM flights WHERE имяСтолбцаВремени > NOW() 
  • I tried the first version before, did not help. but already corrected came. thank you - Oblivion
  • Only in the code one nuance, NOW () is the time on the server side and it may differ from the time on the client side - user205867