Jump to content

Recommended Posts

Posted

I have the currently booked flights showing on my main page of my site. I am having a problem trying to show the airline image for the current booked flight. I can get it to show the spot for the Airline in the title, but I cannot get the image to pull from my image folder. Can someone please please assist me with this. I have been up searching on here for hours and trying to make it work: this is my code:\

Thanks to anyone that can help me with this

<h3>Currently Booked Flights</h3>

<?php

if(!$lastbids)

{

echo '<p align="left">No flights have currently been booked</p>';

return;

}

?>

<table width="100%" cellpadding="1" cellspacing="0">

<thead>

<tr bgcolor="#336699">

<th align="center" style="background-color: #0B3861; ">Airline;</th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Flight</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Depart</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Arrive</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Pilot</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Aircraft</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Tail Number</font></th>

<th align="center" style="background-color: #0B3861; width: 10%;"><font color="#ffffff">Flight Time</font></th>

</tr>

</thead>

<tbody>

<?php

foreach($lastbids as $lastbid)

{

?>

<tr bgcolor="#DDDDDD">

<td height="25" align="center"><?php

$str = "$lastbid->code";

$find="NXP";

$position = strpos($str,$find);

if ($position === false){

echo "<img style='padding-left:3px;' src='http://www.veryicon.com/icon/48/Object/Elements%20alone/Plane.png'>"; } else { echo "<img style='padding-left:3px;' src='http://www.veryicon.com/icon/48/Object/Elements%20alone/Plane.png'>"; }?></td>

<td align="center"><?php echo $lastbid->code . $lastbid->flightnum; ?></a> </td>

<td width="13%" align="center"><span><?php echo $lastbid->depicao; ?></span></td>

<td width="13%" align="center"><span><?php echo $lastbid->arricao; ?></span></td>

<?php

$params = $lastbid->pilotid;

$pilot = PilotData::GetPilotData($params);

$pname = $pilot->firstname;

$psurname = $pilot->lastname;

?>

<td width="20%" align="center"><span><?php echo $pname; ?> <?php echo $psurname; ?></span></td>

<td width="15%" align="center"><span><?php echo $lastbid->aircraft; ?></span></td>

<td width="12%" align="center"><?php echo $lastbid->registration?></td>

<td width="12%" align="center"><span><?php echo $lastbid->flighttime; ?>h</span></td>

</tr>

<?php

}

?>

</tbody>

</table>

Posted

I'm pretty sure you got that code from my site.

The reason why it doesn't work on your site is that it is still looking for my airline code "NXP"! You have to replace that with your own Airline 3 Letter Code but if you only have 1 Airline in your Va. I would remove the whole php Tag for the Image and insert a simple img Tag . Or change the php Tag to a simpler One like if ($lastbid->code == NXP) echo ......your image!

(null)

Posted

The code was from the previous webmaster. He up and vanished like a fart in the wind, So now I am left trying to complete what he started. I will give what you said a try. Thanks for your help.

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...