Jump to content

I want to add sort codes here


AcidRainZ

Recommended Posts

Please help guys on the codes i want to sort the list to highest scores to the lowest.it is currently sorting by name not by scores

 

 

heres the code:

<?php
$scores = new Pod("song_scores");
$whichsong = pods_url_variable('last');
$params = array();
$params['select'] = 't.name, t.score, t.date_played';
$params['where'] = 't.song_url LIKE "%'.$whichsong.'%"';
$params['limit'] = 10;
$scores->findRecords($params);
$total_scores = $scores->getTotalRows();
?>
<?php
   if($whichsong == "" || (strlen($whichsong)<3)){
         echo '<div id="top-score">';
         echo "This tab displays scores only in the individual songs page.";
         echo '<br />Please click <a href="';  
         $permalink = the_permalink();
         echo '">here</a> to view the scores.';
         echo '</div>';         
   }
   else{
      if($total_scores>0){
         echo '<div id="top-score">';   
         echo '<div id="top-score-header"><div class="top-score-name">Name</div><div class="top-score-score">Score</div><div class="top-score-date">Date Played</div></div>';   
         echo '<ol>';
         while ( $scores->fetchRecord() ) {
            echo  '<li><div class="top-score-name"><a href="/members/'. $scores->get_field("name") .'/profile/">' . $scores->get_field("name") . '</a></div><div class="top-score-score">' . $scores->get_field("score") . '</div><div class="top-score-date">' . $scores->get_field("date_played") . '</div>';
         }   
         echo "</ol>";      
         echo "</div>";
      }
      else{
         echo "No scores for this song has been uploaded yet.";
      }
   }
?>

 

MOD EDIT: code tags added.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.