title: Grab min value in PHP from MySQL Database?
body: <p>So I have some numbers that take the name "id" in my MySQL database. I tried this code: </p>
  
  <pre><code>while($row = mysql_fetch_array($result))     
  {
  $id=$row['id'];
  $user = $row['usrname'];
  $fname = $row['fname'];
  $lname = $row['lname'];
  echo "&lt;strong&gt;User:&lt;/strong&gt; ".$user." ".$fname." ".$lname."&lt;br/&gt;";
  echo min($id);
  } 
  </code></pre>
  
  <p>On the last line I tried to echo the min value for id, but it didn't work. Any suggestions?</p>
  
  <p>ANSWER: Use "ASC LIMIT 1"</p>
  
  <pre><code>    while($row = mysql_fetch_assoc($sql)){    
  $id=$row['id'];     
  $user = $row['usrname'];     
  $fname = $row['fname'];     
  $lname = $row['lname'];
  echo "&lt;strong&gt;User:&lt;/strong&gt; ".$user." ".$fname." ".$lname."&lt;br/&gt;";     
  echo $id; 
  }
  </code></pre>