title: Get user rank with MySQL
body: <p>I read many topics about this problem but I can't find the solution.</p>
  
  <p>I have a table (called users) with the users of my website. They have points. For example:</p>
  
  <pre><code>+-----------+------------+
  | User_id   | Points     |
  +-----------+------------+
  | 1         | 12258      |
  | 2         | 112        |
  | 3         | 9678       |
  | 4         | 689206     |
  | 5         | 1868       |
  +-----------+------------+
  </code></pre>
  
  <p>On the top of the page the variable $user_id is set. For example the user_id is 4. Now I would like to get the rank of the user by points (output should be 1 if the user_id is 4).</p>
  
  <p>Thank you very much!</p>