Jump to content

Recommended Posts

Posted

Hi all,

prob a really easy solution to most but its really getting me now :D

I have:

<?php
if(!$reports)
{
echo 'No reports have been filed';
return;
}



?>

 <table width="100%" cellpadding="4" cellspacing="0">
   <tr align="center">
     <th bgcolor="#f5f5f5"><strong>Pilot</strong></th>
     <th bgcolor="#f5f5f5"><strong>Flight Number</strong></th>
     <th bgcolor="#f5f5f5"><strong>Departure</strong></th>
     <th bgcolor="#f5f5f5"><strong>Arrival</strong></th>
     <th bgcolor="#f5f5f5"><strong>Duration</strong></th>
     <th bgcolor="#f5f5f5"><strong>Aircraft</strong></th>
     <th bgcolor="#f5f5f5"><strong>Landing Rate</strong></th>
   </tr>
   <?php
$rowclass = 0;
foreach($reports as $report)
{
?>
   <tr class="row<?php echo $rowclass ?>" align="center">
    <td align="center" scope="col"><?php echo $report->firstname . ' ' . $report->lastname?></td>
     <td scope="col">XLA<?php echo $report->flightnum; ?></td>
     <td scope="col"><?php echo $report->depicao?></td>
     <td scope="col"><?php echo $report->arricao?></td>
     <td scope="col"><?php echo $report->flighttime; ?></td>
     <td scope="col"><?php echo $report->aircraft?></td>
     <td scope="col"><?php echo $report->landingrate; ?> ft/min</td>

   </tr>
   <?php
$rowclass = 1 - $rowclass;
}
?>
 </table>

But on every latest flight I want one to be one colour the second to be another and for the third to go back to the first e.g

1 - Blue

2 - Green

3 - Blue

4 - Green

How would I go about doing that with that code above? Could I get an example please.

Thanks ;)

Posted

I dont know if I was reading that website wrong but, whereabouts in that code would I set it as currently it displays latest flights which if I am correct in saying that code generates it? Its those I want to change colour of.

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