Blu-Express VA Posted May 15, 2011 Report Share Posted May 15, 2011 Hi, I've the module Newest pilots in my website, but it's ordered according to the number of Callsign, my question is: It's possible to order the module Newest pilots not according to Callsign but to the Date of Join?? Thanks Quote Link to comment Share on other sites More sharing options...
Blu-Express VA Posted May 17, 2011 Author Report Share Posted May 17, 2011 Please Reply! Thnx Quote Link to comment Share on other sites More sharing options...
Kairon Posted May 18, 2011 Report Share Posted May 18, 2011 Better late than never , see if it is: <h3>Roster</h3> <p> <table width="100%"> <tr bgcolor="#FF0000" align="center"> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Callsign</font></th> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Name</font></th> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Total Flights</font></th> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Total Hours</font></th> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Rank</font></th> <th height="30px" bgcolor="#FF0000"><font color="#FFFFFF">Hub</font></th> </tr> <?php $query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC"; $list=DB::get_results($query); foreach ($list as $pilot) { $callsign = PilotData::GetPilotCode($pilot->code, $pilot->pilotid); echo '<tr bgcolor="#F5F5F5" align="center"><td height="25px">'.$callsign.'</td> <td height="25px">'.$pilot->firstname.' '.$pilot->lastname.'</td> <td height="25px">'.$pilot->totalflights.'</td> <td height="25px" >'.$pilot->totalhours.'</td> <td height="25px">'.$pilot->rank.'</td> <td height="25px" width="15%">'.$pilot->hub.'</td> </tr>'; } echo '</table>' ?> Quote Link to comment Share on other sites More sharing options...
Blu-Express VA Posted May 20, 2011 Author Report Share Posted May 20, 2011 Where i put this code? $list=DB::get_results($query); What is the file?? Thanks Quote Link to comment Share on other sites More sharing options...
TAV1702 Posted May 20, 2011 Report Share Posted May 20, 2011 Well, it says Roster in the heading, so I am going to take a wild stab at it and say that it is the Pilots Roster which is not what you are after. I am guessing that you are wanting to change the Newest Pilots block that shows up on the front page. If that be the case, you need to edit the frontpage_recentpilots.tpl file. And that part of the code that you just asked about, that would stay in the code as he gave to you IF you were editing your Roster. That is pretty much a call to the database looking for information. However, the way mine works is, the most recent pilot joined is on top with and it goes on down from there. 1 Quote Link to comment Share on other sites More sharing options...
Blu-Express VA Posted June 5, 2011 Author Report Share Posted June 5, 2011 Ok, i modified my code with: <?php $query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC"; $list=DB::get_results($query); foreach ($list as $pilot) { ?> <p><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid). ' ' .$pilot->firstname . ' ' . $pilot->lastname?></a></p> <?php } ?> Thanks to Kairon and TAV1702 Quote Link to comment Share on other sites More sharing options...
Blu-Express VA Posted June 9, 2011 Author Report Share Posted June 9, 2011 Hi, i've other problem, how to change the order from DESC to ASC?, because i change this: $query="SELECT * FROM phpvms_pilots ORDER BY joindate DESC"; with: $query="SELECT * FROM phpvms_pilots ORDER BY joindate ASC"; in my pilot list, but the rank image no view!, this is my code : <h3><font color="#152F60"><?php echo $title?></h3></font> <?php if(!$allpilots) { echo 'There are no pilots!'; return; } ?> <table width="98%" border="0" cellspacing="0"> <thead> <tr> <th id="sample">Pilot ID</th> <th id="sample">Name</th> <th id="sample">Rank</th> <th id="sample">Flights</th> <th id="sample">Hours</th> <th id="sample">Status</th> <th id="sample">IVAO</th> <th id="sample">VATSIM</th> </tr> </thead> <tbody> <?php $query="SELECT * FROM phpvms_pilots ORDER BY joindate ASC"; $list=DB::get_results($query); foreach ($list as $pilot) { /* To include a custom field, use the following example: <td> <?php echo PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); ?> </td> For instance, if you added a field called "IVAO Callsign": echo PilotData::GetFieldValue($pilot->pilotid, 'IVAO Callsign'); */ // To skip a retired pilot, uncomment the next line: //if($pilot->retired == 1) { continue; } ?> <tr> <td width="1%" nowrap><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"> <?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid)?></a> </td> <td> <img src="<?php echo Countries::getCountryImage($pilot->location);?>" alt="<?php echo Countries::getCountryName($pilot->location);?>" /> <?php echo $pilot->firstname.' '.$pilot->lastname?> </td> <td><img src="<?php echo $pilot->rankimage?>" alt="<?php echo $pilot->rank;?>" /></td> <td><?php echo $pilot->totalflights?></td> <td><?php echo Util::AddTime($pilot->totalhours, $pilot->transferhours); ?></td> <td><div align="center"><?php If ($pilot->retired == 0) { echo '<img src="http://www.bluepanoramava.joomlafree.it/green-status.png" />'; } else { echo '<img src="http://www.bluepanoramava.joomlafree.it/red-status.png" />'; } ?></div></td> <td><?php $fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'IVAO ID'); if($fieldvalue != '') { echo '<a href="http://www.ivao.aero/members/person/details.asp?ID='.$fieldvalue.'" target="_blank"><center><center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/yesvat.png" width="20" height="18" border="0" alt="IVAO ID" /></center></a>'; } else { echo '<center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/novat.png" width="20" height="18" border="0"/></center></a>'; } ?> </td> <td><?php $fieldvalue = PilotData::GetFieldValue($pilot->pilotid, 'VATSIM ID'); if($fieldvalue != '') { echo '<a href="http://www.vataware.com/pilot.cfm?cid='.$fieldvalue.'" target="_blank"><center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/yesvat.png" width="20" height="18" border="0" alt="Vatsim ID" /></center></a>'; } else { echo '<center><img src="http://www.bluepanoramava.com/lib/skins/brilliancev1/images/novat.png" width="20" height="18" border="0"/></center></a>'; } ?> <?php ?></td> <?php } ?> </tbody> </table> Thanks in advance Quote Link to comment Share on other sites More sharing options...
RVF147 Posted April 14, 2013 Report Share Posted April 14, 2013 Code worked but how do you limit it to only the last 3 newly hired pilots? It shows my entire roster... 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.