• I have this code which works

    <table width="100%" border="1">
        <tr>
        <th width="10%">Entry ID</th>
        <th width="53%">Entry</th>
         <th width="5%">Vote</th>
         <th width="20%">Rated by</th>
         <th width="12%">Vote ID</th>
    
        </tr>
    
          <?php
    
            global $wpdb;
            $result = $wpdb->get_results ( "SELECT * FROM ***_ratings" );
            foreach ( $result as $print )   {
              echo '<tr>';
             echo '<td>' . $print->rating_postid . '</td>';
    		 echo '<td>' . $print->rating_posttitle . '</td>';
    		  echo '<td>' .'<b>'. $print->rating_rating . '</b>' .'</td>';
                      echo '<td>' . $print->rating_username .'</td>';
    				  echo '<td>' . $print->rating_id .'</td>';
    
              echo '</tr>';
                }
          ?>
    
    </table>

    What I can not get to work is order the results according to rating_postid with the highest value on top. Can someone help me?

  • The topic ‘Order columns’ is closed to new replies.