title: Select user id with a minimum value SQL
body: <p>How do I select from a database table a user id that is linked to the minimum value of the table</p>
  
  <p>for example</p>
  
  <pre><code>User ID    Pending
  -------    --------
  0          5
  1          4
  2          7
  
  '$resultSet = $mysqli-&gt;query("SELECT MIN(write_pending) FROM writerdata_tb");
              if ($temp = $resultSet-&gt;fetch_assoc()) {
  
              }'
  </code></pre>
  
  <p>in this case, I would want the data that is returned to have the value of the user with the least pending, in this case being user 1. How do I set up a MySqli query to handle this? And what would be the best way to save the result as a variable for use in the rest of my php?</p>