Jump to content

Latest Pilots By Date, Not ID


hollinst

Recommended Posts

I know, I know. I should use the search function and try and find my answer. I have been sitting here for an hour trying to find it, and I just can't seem to figure out what words I need to put together to make this thing work...

Here is what I am trying to do. Currently, I have a "Latest Pilots" list on my homepage that is limited to show the 5 most recent pilots by their ID. Well, we change our pilot's IDs when they join to fit into the hub, and I would rather the "Latest Pilots" list to be sorted by date instead of by ID. We just changed webhosts so before this worked fine, and now... I don't remember what I did or where to look to make that happen. Any links are appreciated, and if someone is able to type up a quick tutorial, I would be very grateful!

Thank you! B)

Link to comment
Share on other sites

  • Moderators

Go to core/common/PilotData.class.php file and find this (in my file it's in line 219);

public static function getLatestPilots($count=10)
{
 $sql = 'SELECT * FROM '.TABLE_PREFIX.'pilots
   ORDER BY `pilotid` DESC
   LIMIT '.$count;

 return DB::get_results($sql);
}

and replace it with this:

public static function getLatestPilots($count=10)
{
 $sql = 'SELECT * FROM '.TABLE_PREFIX.'pilots
   ORDER BY `joindate` DESC
   LIMIT '.$count;

 return DB::get_results($sql);
}

Link to comment
Share on other sites

Go to core/common/PilotData.class.php file and find this (in my file it's in line 219);

public static function getLatestPilots($count=10)
{
$sql = 'SELECT * FROM '.TABLE_PREFIX.'pilots
ORDER BY `pilotid` DESC
LIMIT '.$count;

return DB::get_results($sql);
}

and replace it with this:

public static function getLatestPilots($count=10)
{
$sql = 'SELECT * FROM '.TABLE_PREFIX.'pilots
ORDER BY `joindate` DESC
LIMIT '.$count;

return DB::get_results($sql);
}

Thank you so much!!! B)

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