title: MySQL: Changing databases in the middle of a script
body: <p>I've never had to do this before, so really I just want to check and see if I'm approaching this the correct way.</p>
  
  <p>I need to switch databases in the middle of a PHP script, and I'm not sure if there are any security issues, or memory issues, or etc...</p>
  
  <p>So I have my connection code at the top of my page.</p>
  
  <p>And in the middle I do the following:</p>
  
  <pre><code>mysql_select_db("new_db") or die(mysql_error());
  $query = mysql_query("SELECT * FROM new_db table ORDER BY name ASC");
  // Rest of relevant code
  </code></pre>
  
  <p>Now is there a way to kill this connection afterwards, or do I need to switch back below this part?</p>