title: MySQL within classes causing frustration
body: <p>I have this code:</p>
  
  <pre><code>&lt;?php 
  
  class guildData {
  
      public $email = NULL;
      public $hash_pw = NULL;
      public $user_id = NULL;
      public $clean_username = NULL;
      public $display_username = NULL;
  
      public function selectGuild($g_id)
      {
              global $db,$db_table_prefix;
  
              $this-&gt;g_id = $g_id;
  
              $sql = "SELECT
                              name
                              FROM
                              guild
                              WHERE
                              id = '".$g_id."'";
  
              $result = $db-&gt;sql_query($sql);
  
              $row = $db-&gt;sql_fetchrow($result);
  
              return ($row['name']);
      }
  }
  ?&gt;
  &lt;?php echo $guildData-&gt;selectGuild(1); ?&gt;
  </code></pre>
  
  <p>I'm simply getting a 500 error and IDEone gave me this also:</p>
  
  <p>Fatal error: Call to a member function selectGuild() on a non-object in /home/VT00Ds/prog.php on line 32</p>
  
  <p>I can not see the error, can you help me?</p>