title: How to insert the last id from a table into another table in MySQL?
body: <p>I want to take the id of the most recent item in a database, increment it by one and insert that new id in to another table.</p>
  
  <p>I tried:</p>
  
  <pre><code>$select = mysql_query("SELECT id FROM tableName ORDER BY id DESC");
  
  while ($return = mysql_fetch_assoc($select)) {
  
     $id = $return['id'];
     $newId = $id++;
  
  }
  
  mysql_query("INSERT INTO anotherTable (someColumn) VALUES ('$newId')");
  </code></pre>
  
  <p>But it didn't work. How can this be done?</p>