avdesigns Posted October 30, 2012 Report Share Posted October 30, 2012 Hello Is it possible to get a table for latest pilots like this Country (Flag) | Pilot ID - Pilot Name | Hub Thanks in advance Jacob! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 31, 2012 Moderators Report Share Posted October 31, 2012 <table width="40%"> <tr> <th align="center">Country (Flag) </th> <th align="center">|</th> <th align="center">Pilot ID - Pilot Name </th> <th align="center">|</th> <th align="center">HUB</th> </tr> <?php $pilotinfo = PilotData::getallpilots(); foreach($pilotinfo as $pilot) { ?> <tr> <td align ="center"><?php echo Countries::getCountryName($pilot->location);?> ( <img src="<?php echo Countries::getCountryImage($pilot->location);?>"> )</td> <td align="center">|</td> <td align ="center"><?php echo $pilot->code.$pilot->pilotid.' - '.$pilot->firstname.' '.$pilot->lastname ;?></td> <td align="center">|</td> <td align ="center"><?php echo $pilot->hub ;?></td> </tr> <?php } ?> </table> Screenshot: 2 Quote Link to comment Share on other sites More sharing options...
avdesigns Posted October 31, 2012 Author Report Share Posted October 31, 2012 Thankyou! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted October 31, 2012 Moderators Report Share Posted October 31, 2012 You're welcome. Quote Link to comment Share on other sites More sharing options...
Ariel Posted November 1, 2012 Report Share Posted November 1, 2012 what code makes the name a link to the pilots profile!?!?! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 1, 2012 Moderators Report Share Posted November 1, 2012 <table width="40%"> <tr> <th align="center">Country (Flag) </th> <th align="center">|</th> <th align="center">Pilot ID - Pilot Name </th> <th align="center">|</th> <th align="center">HUB</th> </tr> <?php $pilotinfo = PilotData::getallpilots(); foreach($pilotinfo as $pilot) { ?> <tr> <td align ="center"><?php echo Countries::getCountryName($pilot->location);?> ( <img src="<?php echo Countries::getCountryImage($pilot->location);?>"> )</td> <td align="center">|</td> [b]<td align ="center"><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo $pilot->code.$pilot->pilotid.' - '.$pilot->firstname.' '.$pilot->lastname ;?></a></td>[/b] <td align="center">|</td> <td align ="center"><?php echo $pilot->hub ;?></td> </tr> <?php } ?> </table> 1 Quote Link to comment Share on other sites More sharing options...
Ariel Posted November 2, 2012 Report Share Posted November 2, 2012 perfect!! thanx for the code!!! really good addon Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 2, 2012 Moderators Report Share Posted November 2, 2012 You're welcome. Quote Link to comment Share on other sites More sharing options...
avdesigns Posted November 4, 2012 Author Report Share Posted November 4, 2012 Is there a way to limit to the amount to 5? Thanks Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 5, 2012 Moderators Report Share Posted November 5, 2012 Make a file named GetPilotData.class.php. Inside that file write the followng and save it. Now upload it into core/common folder. <?php class GetPilotData extends CodonData { public function getallpilots($limit) { $sql='SELECT * FROM phpvms_pilots ORDER BY pilotid DESC LIMIT '.intval($limit); return DB::get_results($sql); } } ?> Now in the following code <table width="40%"> <tr> <th align="center">Country (Flag) </th> <th align="center">|</th> <th align="center">Pilot ID - Pilot Name </th> <th align="center">|</th> <th align="center">HUB</th> </tr> <?php $pilotinfo = PilotData::getallpilots(); foreach($pilotinfo as $pilot) { ?> <tr> <td align ="center"><?php echo Countries::getCountryName($pilot->location);?> ( <img src="<?php echo Countries::getCountryImage($pilot->location);?>"> )</td> <td align="center">|</td> [b]<td align ="center"><a href="<?php echo url('/profile/view/'.$pilot->pilotid);?>"><?php echo $pilot->code.$pilot->pilotid.' - '.$pilot->firstname.' '.$pilot->lastname ;?></a></td>[/b] <td align="center">|</td> <td align ="center"><?php echo $pilot->hub ;?></td> </tr> <?php } ?> </table> replace this: $pilotinfo = PilotData::getallpilots(); With this: $pilotinfo = GetPilotData::getallpilots(3); 3 is the number of rows the function returns. Thanks 1 Quote Link to comment Share on other sites More sharing options...
avdesigns Posted November 5, 2012 Author Report Share Posted November 5, 2012 Thanks Again Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted November 5, 2012 Moderators Report Share Posted November 5, 2012 YW Quote Link to comment Share on other sites More sharing options...
Ariel Posted February 25, 2013 Report Share Posted February 25, 2013 so i know im about a year later on this...but it works fine its listing the limit i set it too...but how can we get the order around...its listing the pilots from recent to oldest for example the list is from pilot DAL014 to DAL004 I want it to show from DAL004 to DAL014 and keep on adding the newest pilots to the bottom of the list how can we change that!!?? if its even possible! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted February 25, 2013 Moderators Report Share Posted February 25, 2013 In the following code: <?php class GetPilotData extends CodonData { public function getallpilots($limit) { $sql='SELECT * FROM phpvms_pilots ORDER BY pilotid DESC LIMIT '.intval($limit); return DB::get_results($sql); } } ?> Change " ORDER BY pilotid DESC " to " ORDER BY pilotid ASC" and you should be home safe. Quote Link to comment Share on other sites More sharing options...
Ariel Posted February 25, 2013 Report Share Posted February 25, 2013 In the following code: <?php class GetPilotData extends CodonData { public function getallpilots($limit) { $sql='SELECT * FROM phpvms_pilots ORDER BY pilotid DESC LIMIT '.intval($limit); return DB::get_results($sql); } } ?> Change " ORDER BY pilotid DESC " to " ORDER BY pilotid ASC" and you should be home safe. Well it made the change...but now its just showing 10 pilots...which i guess its right i have the limit to show 10 but its showing the first 10 pilots...i have a total of 14 so it should show DAL004 to DAL014 but instead its showing DAL001 to DAL010 i what it to show the last 10 recent pilots not the first 10 pilots check it out so you can see what i mean www.vdelta.org Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted February 25, 2013 Moderators Report Share Posted February 25, 2013 Change it to this: $sql='SELECT * FROM phpvms_pilots ORDER BY pilotid DESC LIMIT 4, '.intval($limit); Quote Link to comment Share on other sites More sharing options...
Ariel Posted February 26, 2013 Report Share Posted February 26, 2013 Parkho, I am for ever gratefull....this did the trick and i thank you SOOOOOO much!! idk what i would have done with out it!!! i owe you one!! Quote Link to comment Share on other sites More sharing options...
Moderators Parkho Posted February 26, 2013 Moderators Report Share Posted February 26, 2013 You're very welcome. Glad I could help. 1 Quote Link to comment Share on other sites More sharing options...
Ariel Posted March 5, 2013 Report Share Posted March 5, 2013 okay we have hit another bump on the road this time its been taking me long to bring it up to you guys but heres the problem.... this code worked fine $sql='SELECT * FROM phpvms_pilots ORDER BY pilotid DESC LIMIT 4, '.intval($limit); problem is ...i have to change the number everytime there is a new pilot...right now that number is at 25 out of 33 pilots that i have...how can i do it so i dont have to log in server side to change this number to show the latest pilots!?!? HELP!! 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.