title: Grabbing mysqli_query Order Number
body: <p>I'm trying to make a leaderboard in which it displays the ranking of the users on the leaderboard. As a result, I was hoping to be able to pull the order number from the MySQL pull which is ordered in various ways i.e (number of posts that the user has sent etc.). Is there an easy way of doing this? Here's an example of one of the leaderboards, the idea is that the ranking will show just before the # i.e. #1 for the person with the highest number of posts:</p>
  <pre><code>
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-lg-4&quot;&gt;
          &lt;div class=&quot;contentbox&quot; style=&quot;overflow: hidden;&quot;&gt;
              &lt;div class=&quot;contentboxheader green&quot;&gt;
                  &lt;i class=&quot;fas fa-comment&quot;&gt;&lt;/i&gt; Most Forum Posts
              &lt;/div&gt;
              &lt;div class=&quot;contentboxtext&quot;&gt;
  &lt;?php 
  $gtp = mysqli_query($con, &quot;SELECT id, posts, habbo 
                             FROM users 
                             ORDER BY posts DESC 
                             LIMIT 10&quot;);
  while ($stp = mysqli_fetch_assoc($gtp)) { 
  ?&gt;
                  
                  &lt;div style=&quot;height: 30px; float: left;   counter-reset: my-sec-counter;&quot;&gt;&lt;div&gt;
          
                  &lt;div class=&quot;leaderboardnumber&quot; style=&quot; counter-increment: my-sec-counter; content: &quot;Section &quot; counter(my-sec-counter) &quot;. &quot;;&quot;&gt;#&lt;/div&gt;
                  &lt;div class=&quot;smallimagefilter&quot;&gt;
                      &lt;img src=&quot;https://www.habbo.com/habbo-imaging/avatarimage?&amp;amp;user=&lt;?php echo ($stp['habbo']); ?&gt;&amp;amp;action=wlk&amp;amp;direction=2&amp;amp;head_direction=2&amp;amp;img_format=png&amp;amp;gesture=std&amp;amp;headonly=0&amp;amp;size=m&quot; class=&quot;leaderboardhabbo&quot;&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;roundedright&quot;&gt;    
  &lt;?php echo username($stp['id']); ?&gt;
              &lt;span style=&quot;float:right;&quot;&gt;&lt;?php echo number_format($stp['posts']); ?&gt; Posts&lt;/span&gt;&lt;/div&gt;&lt;? } ?&gt;
                  
                    &lt;hr&gt; &lt;div class=&quot;forum_user_info&quot; style=&quot;width: 100%;&quot;&gt;
      &lt;b&gt;Your Position&lt;/b&gt;: 213nd&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>