title: PHP PDO Fetch_Assoc not returning correctly
body: <p>I have searched, and maybe I am searching for the wrong thing, but I need help with the below code. I must be missing something...</p>
  
  <p>Database Class:</p>
  
  <pre><code>    class Database {
      private static $link = null;
  
      private static function dbLink() {
          if(self::$link) {
              return self::$link;
          }
  
          $dsn = null;
  
          switch(DB_DRVR) {
              case 'mysql':
                  $dsn = DB_DRVR . ":host=" . DB_HOST . ";dbname=" . DB_NAME;
                  break;
          }
  
          self::$link = new PDO($dsn, DB_USER, DB_PASS);
  
          return self::$link;
      }
  
      public static function fetchAssoc($sql) {
          $stmt = self::query($sql);
          $result = array();
  
          $result = $stmt-&gt;fetch(PDO::FETCH_ASSOC);
  
          return $result;
      }
  
      public static function __callStatic($name, $arguments) {
          $callback = array(self::dbLink(), $name);
          return call_user_func_array($callback, $arguments);
      }
  }
  </code></pre>
  
  <p>Portion of code returning error:</p>
  
  <pre><code>        $sql = "SELECT group FROM users WHERE username='ryan';";
          $dbSQL = Database::fetchAssoc($sql);
  
          echo $dbSQL['group'];
  </code></pre>
  
  <p>Database setup:</p>
  
  <blockquote>
    <ul>
    <li>id(auto_increment, primary)</li>
    <li>name(tinytext)</li>
    <li>username(tinytext)</li>
    <li>password(tinytext)</li>
    <li>salt(tinytext)</li>
    <li>email(tinytext)</li>
    <li>group(tinytext)</li>
    <li>privileges(tinytext)</li>
    </ul>
  </blockquote>
  
  <p>I'm receiving the following error:</p>
  
  <pre><code>Fatal error: Call to a member function fetch() on a non-object
  in C:\public_html\kernel\database.php on line 38
  </code></pre>
  
  <p>However the odd part is if I change the SQL to:</p>
  
  <pre><code>$sql = "SELECT * FROM users WHERE username='ryan';";
  </code></pre>
  
  <p>I don't get the error, it displays properly, and if I change the SQL statement to:</p>
  
  <pre><code>$sql = "SELECT username FROM users WHERE username='ryan';";
  </code></pre>
  
  <p>and call $dbSQL['username'] it works fine using the function above.</p>
  
  <p>My Question: How come when I try to use the 'group' column in my $dbSQL array, I am receiving an error, but when I try to use the 'username' column, everything runs fine. What am I missing?</p>
  
  <p>Thanks,
  Ryan</p>