Hello guys,
I have used the code from the previous page and implemented it in the pilot_public_profile.tpl so it displays the map of pilots flights. But I am struggling with a problem, namely when the pilot has not flown any flights just over the blank map image, the error message pop up:
I have tried playing with a if function, but it doesnt work for me, or maybe I did it in wrong way.
Can anyone help me to solve this problem?
My code is:
<table id="pilotmap" style="border-collapse:collapse; width:590px;">
<thead>
<tr>
<th style="width:100%">Last 10 flights</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<?php
$string = "";
foreach($pireps as $flight)
{
$string = $string.$flight->depicao.'+-+'.$flight->arricao.',+';
}
?>
<p align="center"><img src="http://www.gcmap.com/map?P=<?php echo $string ?>%0D%0A&PM=b%3Asquare3%3Ablack%2B%22%25N%2213r%3Ablack&MS=wls&DU=mi" id="thumb" style="width:590px; height:360px;"/>
<br />
Maps generated by the <a href="http://www.gcmap.com/">Great Circle Mapper</a> - copyright © <a href="http://www.kls2.com/~karl/">Karl L. Swartz</a>.</p></td>
</tr>
</tbody>
</table>
P.S.
And one more thing, how do I make it to get the values of last 10 flights? Because in the original code from the previous page, there was such a line of code
$flights = PIREPData::getRecentReportsByCount(10);
but I did delete it.
Cheers!