Connor1994 Posted July 23, 2011 Report Share Posted July 23, 2011 Hi all, prob a really easy solution to most but its really getting me now 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 Quote Link to comment Share on other sites More sharing options...
Jeff Posted July 23, 2011 Report Share Posted July 23, 2011 There are many websites you can look for what you are wanting, here is one...http://www.tizag.com/htmlT/bgcolor.php Quote Link to comment Share on other sites More sharing options...
Connor1994 Posted July 23, 2011 Author Report Share Posted July 23, 2011 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. Quote Link to comment Share on other sites More sharing options...
Connor1994 Posted July 24, 2011 Author Report Share Posted July 24, 2011 Anything please? Quote Link to comment Share on other sites More sharing options...
James142 Posted July 24, 2011 Report Share Posted July 24, 2011 Anything please? Change <td scope="col"> to <td scope="col" bgcolor="#YOUR COLOR"> Quote Link to comment Share on other sites More sharing options...
Connor1994 Posted July 24, 2011 Author Report Share Posted July 24, 2011 Thanks james! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.