title: Fetch the row of next in rank to the “rank of last id”?
body: <p>Need help!</p>
  
  <p>Mysql query:</p>
  
  <pre><code>CREATE TABLE goal_implement( id INT, percent INT ); 
  
  INSERT INTO goal_implement VALUES 
    (1,10),
    (2,15),
    (3,20),
    (4,40),
    (5,50),
    (6,20);
  </code></pre>
  
  <p>My PHP code - this code display the result table below....</p>
  
  <pre><code>&lt;?php
  $query2 = "SELECT _id, percent, FIND_IN_SET( percent, (
  SELECT GROUP_CONCAT( percent
  ORDER BY percent DESC ) 
  FROM goal_implement )
  ) AS rank
  FROM goal_implement 
  ORDER BY id DESC 
  ";
  </code></pre>
  
  <p>I want this block to be on focus for the comment: I need the php code; NOT mysql query... </p>
  
  <pre><code>$result2 = mysql_query($query2, $connection);
  if($result2 === FALSE) {
      die(mysql_error());
  }
  while($row = mysql_fetch_array($result2))
  {
  echo
  "&lt;tr&gt;
  &lt;td&gt;{$row['id']}&lt;/td&gt;
  &lt;td&gt;{$row['percent']}&lt;/td&gt;
  &lt;td&gt; {$row['rank']} &lt;/td&gt;    
  &lt;/tr&gt;\n";       
  } 
  ?&gt;
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>id  percent rank
  6   20      3
  5   50      1
  4   40      2
  3   20      3
  2   15      5
  1   10      6
  </code></pre>
  
  <p>I don't know how to fetch the row(rank) that is next on the last id for example: last id's rank is 3!I want the result Below.....</p>
  
  <p>Desired result using PHP:</p>
  
  <pre><code>4   40      2
  </code></pre>