title: Retrieve all record and insert to another table form another db
body: <p>I have troubles about php &amp; mysql. I've to retrieve all records from DB1's table and then I have to insert them again to DB2's table.</p>
  
  <pre><code>&lt;?php
  require_once 'includes/config.php';
  include 'includes/header.php';
  if(isset($_POST['go'])){        
      $query = mysql_query("SELECT id,username,password FROM $db_database1.account")
          or die(mysql_error());
  
      echo "Record ".mysql_num_rows($query)." retrieve";
  
      while($result_row = mysql_fetch_array($query, MYSQL_ASSOC)){
          $account_ID = $result_row['id'];
          $username = $result_row['username'];
          $password = $result_row['password'];
          $query = mysql_query("INSERT INTO $db_database2.account(uid,username,password) VALUES('$account_ID','$username','$password')")
              or die(mysql_error());
          $selectId = mysql_insert_id();
      }
  }
  mysql_close($conn);
  ?&gt;
  &lt;div class="wrapper"&gt;
  &lt;div class="content"&gt;
  &lt;form method="post" action="&lt;?PHP $_SERVER['PHP_SELF'];?&gt;"&gt;
  &lt;input type="submit" name="go" value="Go" /&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;?php include 'includes/footer.php';?&gt;
  </code></pre>
  
  <p>According to this code just one record was inserted. How can I insert all retrieved records?</p>