title: PHP mysql_close() and mysql_free_result() - at what point should I be using them?
body: <p>I've been using Dreamweaver to develop PHP and MySQL based websites, but as it tends to overdo simple things I normally write my own queries and PHP to handle the results.</p>
  
  <p>After doing a more complex page, I can have up to 5 <code>SELECTs</code> and as many <code>UPDATEs</code>, maybe more in loops etc.</p>
  
  <p>Persistent connections are <em>not</em> being used, and I only connect to the database once per script.</p>
  
  <p>What I want to know is, given that I only connect to MySQL once, does the amount / complexity of queries have much impact with regards to MySQL connections, and do I <em>ever</em> need to explictly call <code>mysql_close()</code> in my scripts?</p>
  
  <p>Also at what point should I start using <code>mysql_free_result()</code> (or should I be using it anyway?)</p>
  
  <p>A psuedo-example of the type of thing I'm concerned about:</p>
  
  <pre><code>connect to database;
  
  aSelect;
  
  do {
      anUpdate;
  } while(select has rows);
  
  anotherSelect;
  
  anotherSelect;
  
  anUpdate;
  
  do {
      aSelect;
      anUpdate;
  } while (anotherSelect has rows);
  
  anotherUpdate;
  
  aVeryBigSelect;
  
  //end of file
  //no mysql_free_result() or mysql_close() calls, should there be?
  </code></pre>