title: database query's from class object with php
body: <p>My question is:</p>
  
  <p>Can I still do query's from within an object like this:</p>
  
  <pre><code>$result = mysql_query ($q,$dbc) 
            or 
            trigger_error("Query: $q\n&lt;br /&gt;MySQL Fout: " . mysql_error($dbc));
  </code></pre>
  
  <p>by <strong>passing the global</strong> dbconnection variable <strong>$dbc</strong> to the constructor</p>
  
  <p>or is there a better way?</p>
  
  <p>Or <strong>creating a singleton class</strong> for the databaseconnection, but 
  I see a lot off negativity that people are writing about it.</p>
  
  <p>I am new to making objects, so I don't know if I mayby have to do it all a little
  different, with the db I mean.</p>
  
  <p>thanks, Richard</p>