Jump to content

Latest Pilots Table


avdesigns

Recommended Posts

  • Moderators

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

tab.png

  • Like 2
Link to comment
Share on other sites

  • Moderators
<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>

  • Like 1
Link to comment
Share on other sites

  • Moderators

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

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

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!

Link to comment
Share on other sites

  • Moderators

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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