bass Posted October 14, 2016 Report Share Posted October 14, 2016 I have code in which I list the flights. Help write the code, so if flight is not found, displays a message that NO schedules! <table class="table table-bordered" width="40%" border="0" cellspacing="0" cellpadding="0"> <tr class="active"> <th colspan="7"><center> СпиÑок рейÑов из ÐÑропорта </center></th> </tr> <tr class="active"> <th>Ðомер рейÑа <i class="soap-icon-status"></i></th> <th>ÐÑропорт вылета <i class="soap-icon-securevault"></i></th> <th>ÐÑропорт Ð¿Ñ€Ð¸Ð±Ñ‹Ñ‚Ð¸Ñ <i class="soap-icon-securevault"></i></th> <th>Вылет<i class="soap-icon-wifi"></i></th> <th>Ð’Ñ€ÐµÐ¼Ñ Ð² пути<i class="soap-icon-wifi"></i></th> <th>ДальноÑÑ‚ÑŒ<i class="soap-icon-wifi"></i></th> <th>Ðазначен борт<i class="soap-icon-wifi"></i></th> </tr> <?php $query = "SELECT * FROM phpvms_schedules WHERE depicao='$name->icao'"; $Result = DB::get_results($query); foreach($Result as $ { ?> <tr> <td><?php echo $b->code; ?><?php echo $b->flightnum; ?></td> <td><?php echo $b->depicao; ?> <?php $country = OperationsData::getAirportInfo($b->depicao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/> </td> <td><?php echo $b->arricao; ?> <?php $country = OperationsData::getAirportInfo($b->arricao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/></td> <td><?php echo $b->deptime; ?></td> <td><?php echo $b->arrtime; ?></td> <td><?php echo $b->distance; ?> Ml</td> <td><?php echo $b->airbr; ?></td> </tr> <?php } ?> </table> Quote Link to comment Share on other sites More sharing options...
bass Posted October 14, 2016 Author Report Share Posted October 14, 2016 Quote Link to comment Share on other sites More sharing options...
bass Posted October 14, 2016 Author Report Share Posted October 14, 2016 (edited) As seen in the photo, if there are no schedules, the system displays an error message. How to make wrote message! THERE ARE NO SCHEDULES ??? Edited October 14, 2016 by bass Quote Link to comment Share on other sites More sharing options...
web541 Posted October 14, 2016 Report Share Posted October 14, 2016 Are you able to post your full code (module if needed), where is the $name->icao variable coming from? $query = "SELECT * FROM phpvms_schedules WHERE depicao='$name->icao'"; Quote Link to comment Share on other sites More sharing options...
Sava Posted October 14, 2016 Report Share Posted October 14, 2016 (edited) <table class="table table-bordered" width="40%" border="0" cellspacing="0" cellpadding="0"> <tr class="active"> <th colspan="7"><center> СпиÑок рейÑов из ÐÑропорта </center></th> </tr> <tr class="active"> <th>Ðомер рейÑа <i class="soap-icon-status"></i></th> <th>ÐÑропорт вылета <i class="soap-icon-securevault"></i></th> <th>ÐÑропорт Ð¿Ñ€Ð¸Ð±Ñ‹Ñ‚Ð¸Ñ <i class="soap-icon-securevault"></i></th> <th>Вылет<i class="soap-icon-wifi"></i></th> <th>Ð’Ñ€ÐµÐ¼Ñ Ð² пути<i class="soap-icon-wifi"></i></th> <th>ДальноÑÑ‚ÑŒ<i class="soap-icon-wifi"></i></th> <th>Ðазначен борт<i class="soap-icon-wifi"></i></th> </tr> <?php $query = "SELECT * FROM phpvms_schedules WHERE depicao='$name->icao'"; $Result = DB::get_results($query); if($Result != null) { foreach($Result as $ { ?> <tr> <td><?php echo $b->code; ?><?php echo $b->flightnum; ?></td> <td><?php echo $b->depicao; ?> <?php $country = OperationsData::getAirportInfo($b->depicao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/> </td> <td><?php echo $b->arricao; ?> <?php $country = OperationsData::getAirportInfo($b->arricao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/></td> <td><?php echo $b->deptime; ?></td> <td><?php echo $b->arrtime; ?></td> <td><?php echo $b->distance; ?> Ml</td> <td><?php echo $b->airbr; ?></td> </tr> <?php } ?> </table> <?php } else { echo 'No Schedules'; } ?> Try this, and modify the string to what you need for the page to look good and how you want. Let me know if it works. Edited October 14, 2016 by Sava Quote Link to comment Share on other sites More sharing options...
bass Posted October 15, 2016 Author Report Share Posted October 15, 2016 Are you able to post your full code (module if needed), where is the $name->icao variable coming from? $query = "SELECT * FROM phpvms_schedules WHERE depicao='$name->icao'"; Is the module "Airport", I just decided to fill it as different information. Quote Link to comment Share on other sites More sharing options...
bass Posted October 15, 2016 Author Report Share Posted October 15, 2016 <table class="table table-bordered" width="40%" border="0" cellspacing="0" cellpadding="0"> <tr class="active"> <th colspan="7"><center> СпиÑок рейÑов из ÐÑропорта </center></th> </tr> <tr class="active"> <th>Ðомер рейÑа <i class="soap-icon-status"></i></th> <th>ÐÑропорт вылета <i class="soap-icon-securevault"></i></th> <th>ÐÑропорт Ð¿Ñ€Ð¸Ð±Ñ‹Ñ‚Ð¸Ñ <i class="soap-icon-securevault"></i></th> <th>Вылет<i class="soap-icon-wifi"></i></th> <th>Ð’Ñ€ÐµÐ¼Ñ Ð² пути<i class="soap-icon-wifi"></i></th> <th>ДальноÑÑ‚ÑŒ<i class="soap-icon-wifi"></i></th> <th>Ðазначен борт<i class="soap-icon-wifi"></i></th> </tr> <?php $query = "SELECT * FROM phpvms_schedules WHERE depicao='$name->icao'"; $Result = DB::get_results($query); if($Result != null) { foreach($Result as $ { ?> <tr> <td><?php echo $b->code; ?><?php echo $b->flightnum; ?></td> <td><?php echo $b->depicao; ?> <?php $country = OperationsData::getAirportInfo($b->depicao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/> </td> <td><?php echo $b->arricao; ?> <?php $country = OperationsData::getAirportInfo($b->arricao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/></td> <td><?php echo $b->deptime; ?></td> <td><?php echo $b->arrtime; ?></td> <td><?php echo $b->distance; ?> Ml</td> <td><?php echo $b->airbr; ?></td> </tr> <?php } ?> </table> <?php } else { echo 'No Schedules'; } ?> Try this, and modify the string to what you need for the page to look good and how you want. Let me know if it works. No, did not help( Error - Warning: Invalid argument supplied for foreach() in /home/vaflying/public_html/cargo/lib/skins/travelo/airport_info.tpl on line 228 Error shows in this line: if($Result != null) { Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 15, 2016 Members Report Share Posted October 15, 2016 (edited) <table class="table table-bordered" width="40%" border="0" cellspacing="0" cellpadding="0"> <tr class="active"> <th colspan="7"><center> СпиÑок рейÑов из ÐÑропорта </center></th> </tr> <tr class="active"> <th>Ðомер рейÑа <i class="soap-icon-status"></i></th> <th>ÐÑропорт вылета <i class="soap-icon-securevault"></i></th> <th>ÐÑропорт Ð¿Ñ€Ð¸Ð±Ñ‹Ñ‚Ð¸Ñ <i class="soap-icon-securevault"></i></th> <th>Вылет<i class="soap-icon-wifi"></i></th> <th>Ð’Ñ€ÐµÐ¼Ñ Ð² пути<i class="soap-icon-wifi"></i></th> <th>ДальноÑÑ‚ÑŒ<i class="soap-icon-wifi"></i></th> <th>Ðазначен борт<i class="soap-icon-wifi"></i></th> </tr> <?php $params['s.depicao']= $name->icao ; $query = SchedulesData::findSchedules($params); if($query != null) { foreach($query as $ { ?> <tr> <td><?php echo $b->code; ?><?php echo $b->flightnum; ?></td> <td><?php echo $b->depicao; ?> <?php $country = OperationsData::getAirportInfo($b->depicao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/> </td> <td><?php echo $b->arricao; ?> <?php $country = OperationsData::getAirportInfo($b->arricao); $imgicao = array_search($country->country, Countries::$countries); ?> <img src="<?php echo SITE_URL; ?>/lib/images/countries/<?php echo strtolower($imgicao); ?>.png" alt="<?php echo strtolower($imgicao); ?>"/></td> <td><?php echo $b->deptime; ?></td> <td><?php echo $b->arrtime; ?></td> <td><?php echo $b->distance; ?> Ml</td> <td><?php echo $b->airbr; ?></td> </tr> <?php } ?> </table> <?php } else { echo 'No Schedules'; } ?> Edited October 15, 2016 by Vangelis Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted October 15, 2016 Members Report Share Posted October 15, 2016 (edited) 2ond post please delete Edited October 15, 2016 by Vangelis 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.