Jump to content

Departure board


HighFlyerPL185

Recommended Posts

here's the query I use:

$utc_now_str = gmdate("H:i");

$query= "SELECT ".TABLE_PREFIX."schedules.id, deptime, arrtime, code, flightnum, arricao, ".TABLE_PREFIX."airports.name destination, depicao, aircraft, ".TABLE_PREFIX."aircraft.icao equipment, bidid,

round( time_to_sec( timediff( time( str_to_date( deptime, '%H:%i' ) ) ,'".$utc_now_str."' ) ) /60, 0 ) timediff

FROM ".TABLE_PREFIX."schedules, ".TABLE_PREFIX."aircraft, ".TABLE_PREFIX."airports

WHERE code = 'EUR'

AND locate(dayofweek(convert_tz(now(),'+1:00','+0:00'))-1,".TABLE_PREFIX."schedules.daysofweek)>0

AND ".TABLE_PREFIX."schedules.arricao = ".TABLE_PREFIX."airports.icao

AND ".TABLE_PREFIX."schedules.aircraft = ".TABLE_PREFIX."aircraft.id

AND round( time_to_sec( timediff( time( str_to_date( deptime, '%H:%i' ) ) , '".$utc_now_str."' ) ) /60, 0 ) <60

AND round( time_to_sec( timediff( time( str_to_date( deptime, '%H:%i' ) ) , '".$utc_now_str."' ) ) /60, 0 ) > -15

ORDER BY timediff limit 12";

The timetable is on the frontpage of my VA.

Link to comment
Share on other sites

Hey highflyer,

yes, you would use foreach, just like you would on any other "recordset". I posted the query assuming you'd know how to implement it in the code :)

the table_prefix variable should be already set in the config.php so you didn't have to change it.

Sorry for being a pain in the backside, but I am having trouble implementing the query in. I've wrote a foreach statement, but it's probably wrong and embarrasing, hence it's showing a Warning: Invalid argument supplied for foreach(). Do you have any example of how I'd implement it or maybe which variables I should use for the foreach statement?

Link to comment
Share on other sites

  • Moderators

Hey highflyer,

yes, you would use foreach, just like you would on any other "recordset". I posted the query assuming you'd know how to implement it in the code :)

the table_prefix variable should be already set in the config.php so you didn't have to change it.

Nice. :) You could also set it up for your pilots to bid on the flights right there instead of going through schedule search but of course if they're logged in. :D

  • Like 1
Link to comment
Share on other sites

@parkho: Well, normally if you click on the flight number on my departure board you get to the flight info page, where logged-in pilots can place a bid :)

I suppose, I'm just a newbie to PHP and henceforth queries and statements like foreach are still beyond me. To put it bluntly, I haven't done much so far to develop that knowledge :)

that's ok... I never did anything with PHP before I started working on phpvms. I kinda learned php because phpvms is written in it and now, 6 months later, my phpvms is very different from the stock phpvms :)

Once I get my VA search engine working, I'll start publishing some of the "add-ons" I made for PHPvms, but until then I think you'll have to crawl the web and learn php yourself :)

or you may try this: http://www.utr-onlin...ware.asp?page=7

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...