title: Getting the Max value of a column in a database table
body: <p>I'm trying to get the max value of a column in a database table.</p>
  
  <p>This is my PHP:</p>
  
  <pre><code>$st = mysql_fetch_assoc(mysql_query("SELECT max(`version`) FROM `remembers` WHERE id='$id'"));
  $version = $st['version'] + 1;
  </code></pre>
  
  <p>So that should get the current version of <code>id</code> and then update it but adding 1 to it. But <code>$st['version']</code> seems to be returning <code>0</code> when in the database the current highest is <code>1</code></p>
  
  <p>Am I doing this wrong? Is there a better way to archive this? </p>