title: how to increment values inside a table
body: <p>I have a table like this</p>
  
  <pre><code>|Rank|Location|Items|
  ---------------------
  |    |Japan   |45   |
  |    |China   |31   |
  |    |Korea   |10   |
  </code></pre>
  
  <p>i want the result to be like this</p>
  
  <pre><code>|Rank|Location|Items|
  ---------------------
  |   1|Japan   |45   |
  |   2|China   |31   |
  |   3|Korea   |10   |
  </code></pre>
  
  <p>I used php because i get the data of the location and items from a database then i used a while loop to print the data from the database to the table. Inside the while loop, I tried putting a $i=1 then a $i++ for the ranking but it doesn't seem to work because it did not increment. Am i Doing it wrong or is there another way? 
  Here is my code:</p>
  
  <pre><code>&lt;?php
  
              $server = mysql_connect("localhost","root", "");
              $db =  mysql_select_db("cvgcrm",$server);
              $query = mysql_query("select cf_795, count(*) as Referrals from vtiger_leadscf group by cf_795 order by Referrals DESC");
          ?&gt;
  
          &lt;table class="striped"&gt;
          &lt;table align="center"&gt;
              &lt;tr class="header"&gt;
                  &lt;td&gt;Rank&lt;/td&gt;
                  &lt;td&gt;Location&lt;/td&gt;
                  &lt;td&gt;Items&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;?php
                 while ($row = mysql_fetch_array($query)) {
                     $i = 1;
                     echo "&lt;tr&gt;";
                     echo "&lt;td&gt;".$i."&lt;/td&gt;";
                     echo "&lt;td&gt;".$row[location]."&lt;/td&gt;";
                     echo "&lt;td&gt;".$row[items]."&lt;/td&gt;"; 
                     echo "&lt;/tr&gt;";
                     $i=$i+1;
                 }
  
              ?&gt;
  </code></pre>