Jump to content

2 Arrays in one table


AFVA | Mitchell

Recommended Posts

G'day all,

I am working on a advanced fleet page at the moment and ran into a problem.

I want the ICAO, Type, Registration, Range, Empty Weight, Cruise Alt, Max Pax, Max Cargo, Total Hours, Total Distance Flown and Total Flight Time.

The problem is that i am trying to use both OperationsData (for ICAO to Total Hours) and StatsData (for Total Distance and Total Flight Time) in one table which is getting hard.

My code without StatsData

<?php $allaircraft = OperationsData::GetAllAircraft(); ?>
<?php
if(!$allaircraft)
{
echo '<p id="error">No aircraft have been added</p>';
return;
}
?>
<table border="1">
<thead>  
<tr><td><b>ICAO</b></td><td><b>Type</b></td><td><b>Registration</b></td><td><b>Range</b></td><td><b>Empty Weight</b></td><td><b>Cruise Alt</b></td><td><b>Max Pax</b></td><td><b>Max Cargo</b></td><td><b>Total Hours</b></td></tr>
</thead>
<tbody>
<?php foreach ($allaircraft as $aircraft) 
{
?>
<tr>
<td><?php echo $aircraft->icao; ?> </td>
<td><?php echo $aircraft->name; ?> </td>
<td><?php echo $aircraft->registration; ?></td>
<td><?php echo $aircraft->range; ?> </td>
<td><?php echo $aircraft->weight; ?></td>
<td><?php echo $aircraft->cruise; ?></td>
<td><?php echo $aircraft->maxpax; ?></td>
<td><?php echo $aircraft->maxcargo; ?></td>
</tr>
<?php } ?>
</tbody>
</table>

Can someone please tell me if it is possible to have two different arrays in one table?

Thanks in advance,

Mitchell

(I have finally worked out how to make modules, may help when comes to coding. Fleet.php can be posted on request)

Link to comment
Share on other sites

  • Administrators

Mitchell, you might kill me, the module format has changed a bit, unless you're on beta and you're using the new format. But, it's MUCH easier :)

Also, sure, it's possible. Do you have your code with the StatsData? IIRC, that returns an array with all the aircraft.

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