Alex Posted May 27, 2010 Report Share Posted May 27, 2010 Maybe the time actually need to be decimalized, so that 15 mins would be 0.25 rather than 1/60*15. I'll try later. Its bloody annoying this isn't it. Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted May 27, 2010 Author Report Share Posted May 27, 2010 Maybe the time actually need to be decimalized, so that 15 mins would be 0.25 rather than 1/60*15. I'll try later. Its bloody annoying this isn't it. Tell me about it. What I'm uncertain about is that your aren't using "else". Wouldn't that mean that if 2 conditions were true, they would both be displayed? Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted May 27, 2010 Administrators Report Share Posted May 27, 2010 Try this out guys -> http://pastebin.com/Yr1aGv4m Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted May 27, 2010 Moderators Report Share Posted May 27, 2010 Cheers Dave works a treat Quote Link to comment Share on other sites More sharing options...
Alex Posted May 27, 2010 Report Share Posted May 27, 2010 THANKS DAVE. looks like we were a million miles away and needed rescueing!!! Works a treat. Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 27, 2010 Report Share Posted May 27, 2010 Gents, I have this on my front page now and very nice it looks too! 1 question though, I am looking to change the time so it reflects my own timezone. Someone said you need to go into the php.ini, where can I find this please? Cheers Dale Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 27, 2010 Report Share Posted May 27, 2010 Also, how do I go about changing the colour of the tables please? Cheers. Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted May 27, 2010 Author Report Share Posted May 27, 2010 Also, how do I go about changing the colour of the tables please? Cheers. You can use something like this. echo '<table width="90%" border="1" bordercolor="#ffffff" bgcolor="#B6C7DB">'; Quote Link to comment Share on other sites More sharing options...
dimitris Posted May 27, 2010 Report Share Posted May 27, 2010 hello all! i m using the following code to take the Flight Board but i m getting a warning ! look the code : <?php $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; $list = DB::get_results($query); echo '<h3>Expected Departures - Current Time is '.date('G:i').'</h3>'; echo '<table width="90%" border="1">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Departure Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->deptime + 0) > $time) { if($count < 5) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->deptime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->deptime - date('G:i')) <= 1 / 60 * 15) { echo 'Final Call'; } if(($flight->deptime - date('G:i')) <= 1) { echo 'Proceed to Gate'; } else { echo 'Scheduled Departure'; } echo '</td></tr>'; $count++; } } } echo '</table>'; echo '<h3>Expected Arrivals - Current Time is '.date('G:i').'</h3>'; echo '<table width="90%" border="1">'; echo '<tr><td><b>Flight Number</b></td><td><b>Departure</b></td><td><b>Arrival</b></td><td><b>Arrival Time</b></td><td><b>Aircraft</b></td><td><b>Status</b></td></tr>'; $count = 0; foreach($list as $flight) { if(date('G:i') >= '23') {$time = '0';} else {$time = date('G:i');} if(($flight->arrtime + 0) > $time) { if($count < 5) { $aircraft = OperationsData::getAircraftInfo($flight->aircraft); echo '<tr><td>'.$flight->flightnum.'</td><td>'.$flight->depicao.'</td><td>'.$flight->arricao.'</td><td>'.$flight->arrtime.'</td><td>'.$aircraft->fullname.'</td>'; echo '<td>'; if(($flight->arrtime - date('G:i')) <= 1 / 60 * 1) { echo 'Landed'; } if(($flight->arrtime - date('G:i')) <= 1 / 60 * 15) { echo 'On Approach'; } else { echo 'On Time'; } echo '</td></tr>'; $count++; } } } echo '</table>'; ?> and the worning is this : Warning: Invalid argument supplied for foreach() in /home/greeceai/public_html/fss/core/templates/acarsmap.tpl on line 8 Warning: Invalid argument supplied for foreach() in /home/greeceai/public_html/fss/core/templates/acarsmap.tpl on line 46 i use the live map tab on the menu... i replace the live map code witht this code and the result is this in picture following please help me ! Best regards Dimitris Quote Link to comment Share on other sites More sharing options...
Txmmy83 Posted May 27, 2010 Report Share Posted May 27, 2010 I am also getting an invalid argument in the foreach but my refer to another file Expected Departures - Current Time is 23:28 Warning: Invalid argument supplied for foreach() in /home/simaerobatic/domains/forum.simaerobatic.com/htdocs/lib/skins/ObsessBlue/frontpage_main.tpl on line 244 Flight Number Departure Arrival Departure Time Aircraft Status Expected Arrivals - Current Time is 23:28 Warning: Invalid argument supplied for foreach() in /home/simaerobatic/domains/forum.simaerobatic.com/htdocs/lib/skins/ObsessBlue/frontpage_main.tpl on line 282 Flight Number Departure Arrival Arrival Time Aircraft Status BR Thomas Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted May 27, 2010 Author Report Share Posted May 27, 2010 I suspect it has something to do with the code to prevent a blank board from 2300 to 2359 and the new code. I guess I'll find out in 7 hours. Although simpilot is the one who knows this stuff, if anyone can post the code on the line where the error is reported. I'll take a look. Maybe, I'll get lucky. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted May 28, 2010 Administrators Report Share Posted May 28, 2010 That error is telling you that the "$list" variable is coming back empty, there is nothing for the foreach command to look at. Do you have any schedules in your DB? @dimitris - that is the older code as well. Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted May 28, 2010 Author Report Share Posted May 28, 2010 One minor glitch. Between 23:00 and 23:59, the new code cannot display "landed" or "departed" because the time has been set to zero. I can live with one hour out of 24 having that problem. Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted May 28, 2010 Report Share Posted May 28, 2010 Gents, I have this on my front page now and very nice it looks too! 1 question though, I am looking to change the time so it reflects my own timezone. Someone said you need to go into the php.ini, where can I find this please? Cheers Dale You should be able to set the server time through the php.ini file I set ours to ZULU using the following inside of the php.ini date.timezone = "ZULU" Additional options at http://php.net/timezones The php.ini file is usually located in the root folder, at least mine is . Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 28, 2010 Report Share Posted May 28, 2010 What I can't figure out is, if the script is pulling the flight schedule out by time, then why do the times jump around? And also, how can you add the Airline just before the Flight Number so they know what airline the flight belongs to? Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 28, 2010 Report Share Posted May 28, 2010 And also, how can you add the Airline just before the Flight Number so they know what airline the flight belongs to? Here is the code: <td>'.$flight->code.$flight->flightnum.'</td> If you want to add the Airline instead of showing the aircraft name: <td>'.$flight->notes.'</td> If you want to see how it is set up on my site My link Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 28, 2010 Report Share Posted May 28, 2010 The php.ini file is usually located in the root folder, at least mine is . Could you give me path please, I still cant find it! Quote Link to comment Share on other sites More sharing options...
Txmmy83 Posted May 28, 2010 Report Share Posted May 28, 2010 That error is telling you that the "$list" variable is coming back empty, there is nothing for the foreach command to look at. Do you have any schedules in your DB? @dimitris - that is the older code as well. I had at least 20 flights in database at time of this error BR Thomas Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 28, 2010 Report Share Posted May 28, 2010 Been playing around and reading some stuff. This is what I have come up with on my site now: Expected Departures - Current Time is Fri May 28 05:07:30 EDT 2010 and Expected Arrivals - Current Time is Fri May 28 05:07:30 EDT 2010 This is the the line of code I used: echo '<h3>Expected Departures - Current Time is '.date('D M j H:i:s T Y').'</h3>'; I still cant get it to say CEST instead of EDT though, cant find the bloody fabled php.ini file lol. Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 28, 2010 Report Share Posted May 28, 2010 Got it working to show CEST instead of EDT!! Without going into the php.ini. It iis also showing the correct time for my timezone. <?php date_default_timezone_set('Europe/Berlin'); $query = "SELECT * FROM phpvms_schedules ORDER BY deptime + 0 ASC"; $list = DB::get_results($query); echo '<h3>Expected Departures - Current Time is '.date('D M j H:i:s T Y').'</h3>'; Hope this helps peeps. 1 Quote Link to comment Share on other sites More sharing options...
dimitris Posted May 28, 2010 Report Share Posted May 28, 2010 That error is telling you that the "$list" variable is coming back empty, there is nothing for the foreach command to look at. Do you have any schedules in your DB? @dimitris - that is the older code as well. well ok my DB have more than 65 flights... which is the new code ? Quote Link to comment Share on other sites More sharing options...
CrashGordon Posted May 28, 2010 Author Report Share Posted May 28, 2010 Depending on what setup your host has, try going to your control panel. Look for something that says PHP Configuration. Select central php.ini to be placed in your root directory. Activate those settings. You may find the file is named php.ini.default. Edit the file by finding the time zone setting and change it to Zulu. Save the file and rename it to php.ini. Your system will then be on UTC. Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted May 28, 2010 Administrators Report Share Posted May 28, 2010 well ok my DB have more than 65 flights... which is the new code ? Do your flights have the departure and arrival fields filled? Have you changed the prefix for your database from the standard "phpvms_"? Try a print_r using the $list variable and see what, if anything at all is coming back. New Code -> http://forum.phpvms.net/topic/2811-request-flight-board/page__view__findpost__p__19704 Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted May 28, 2010 Administrators Report Share Posted May 28, 2010 What I can't figure out is, if the script is pulling the flight schedule out by time, then why do the times jump around? And also, how can you add the Airline just before the Flight Number so they know what airline the flight belongs to? The deptime and arrtime fields in the database are not true time fileds, they are varchar. So trying to sort numerically does not work well. If the time was not stored with the : it work better, but that is the nature of the beast. The sort function is looking at the numerical value prior to the non numerical character - ie the 12 of 12:35, the 35 is ignored. So, when the sort comes out with all the schedules with a 12 prior to the : it sorts them in their order in the database as a secondary sort. What you can do to fix it is go in the schedules database and erase your schedules, then input them in the order of times. It would take some work to keep the order correct that both the deptime and arrtime fields were in the correct order to display in order on your site. Quote Link to comment Share on other sites More sharing options...
dimitris Posted May 28, 2010 Report Share Posted May 28, 2010 Do your flights have the departure and arrival fields filled? Have you changed the prefix for your database from the standard "phpvms_"? Try a print_r using the $list variable and see what, if anything at all is coming back. New Code -> http://forum.phpvms.net/topic/2811-request-flight-board/page__view__findpost__p__19704 That was the problem ! thank you so much it is working now ! Quote Link to comment Share on other sites More sharing options...
Txmmy83 Posted May 28, 2010 Report Share Posted May 28, 2010 thanks that also my problem fixing that now Quote Link to comment Share on other sites More sharing options...
dimitris Posted May 28, 2010 Report Share Posted May 28, 2010 ok the Board is ok... but now i m flying LGAV-LBSF and the board is blank! this have to do with the time zones ? local time is 20:25 and UTC 17:25 Quote Link to comment Share on other sites More sharing options...
Jeff Posted May 28, 2010 Report Share Posted May 28, 2010 Got it working to show CEST instead of EDT!! Without going into the php.ini. It iis also showing the correct time for my timezone. How were you able to get the 3 different items for status (Departed, on-time...etc)? Quote Link to comment Share on other sites More sharing options...
dale0404 Posted May 28, 2010 Report Share Posted May 28, 2010 How were you able to get the 3 different items for status (Departed, on-time...etc)? Its all in the code mate. Here: http://forum.phpvms.net/topic/2811-request-flight-board/page__view__findpost__p__19704 Quote Link to comment Share on other sites More sharing options...
CPC900 Posted May 28, 2010 Report Share Posted May 28, 2010 So just to confirm.....this has nothing to do with live flights, right?! Just for displaying what would be going on in your schedule if it was really happenning?! Just so I tell my users the correct info. Works good, btw. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.