title: Codeigniter: Get the row number out of the query result based on given criteria
body: <p>I have a mysql table - mytable, like this:</p>
  
  <pre><code>name | sales
  Mark | 4
  Steve | 2
  Rick | 5
  David | 1
  </code></pre>
  
  <p>when fetching the result based on the number of sales done like:</p>
  
  <pre><code>$this-&gt;db-&gt;select('name,sales');
  $this-&gt;db-&gt;where('sales &gt;=', '2');
  $this-&gt;db-&gt;order_by("sales", "desc"); 
  $query = $this-&gt;db-&gt;get('mytable');
  </code></pre>
  
  <p>and put in a table with rank, it would look like:</p>
  
  <pre><code>Rank | Name | Sales
  1 | Rick | 5
  2 | Mark | 4
  3 | Steve | 2
  </code></pre>
  
  <p>But, I don't want to put it in a table. Instead, I want to know the rank of a person based on the query criteria. For example, given the name Mark, I should directly get his row number (rank) as '2'. What would be my mysql query to achieve this using codeigniter active record?</p>