Jump to content

Help to finish the code.


bass

Recommended Posts

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>
Link to comment
Share on other sites

<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 by Sava
Link to comment
Share on other sites

<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) {

Link to comment
Share on other sites

  • Members
<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 by Vangelis
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...