title: Proper use of database class in PHP?
body: <p>I've written a fairly simple database class in PHP that supports the most basic stuff such as connecting/disconnecting, querying, fetching data etc.</p>
  
  <p>I know I'm reinventing the wheel here but there is some learning aspects behind this. I've tested it out and it works well. Now I want to make use of this class for a website I run that I know have a fair amount of simultaneous users at any given time and I found myself somewhat uncertain as to how to use the class.</p>
  
  <p>Do I create a new instance each time I want to use the class? Lets say I have a function that lists something i my database, do I do something like this?:</p>
  
  <pre><code>function listStuff() {
      $db = new Database();
      $db-&gt;connect();
      $result = $db-&gt;query($someQuery);
      //do stuff with result
      $db-&gt;dicsonnect();
  }
  </code></pre>
  
  <p>This seems to create an unnecessary amount of objects in memory, so how would I go about it to reuse objects but still be able to have simultaneous users?</p>
  
  <p>Thanks!</p>