title: How to convert class method to static method? PDO query
body: <p>I have a simple query method with constructor:</p>
  
  <pre><code>class mysql_a {
  
  public $db;
  
  public function __construct($db) {
      $this-&gt;db=$db;
      }
  
  public function find_by_id() {
     $result =  $this-&gt;db-&gt;query('SELECT * FROM users WHERE id=2 LIMIT 1')-&gt;fetch(PDO::FETCH_ASSOC);
     return $result;
     }
  
  }
  
  $found = new mysql_a($db);
  $res = $found-&gt;find_by_id();
  echo $res['username'];
  </code></pre>
  
  <p>How can I make function "find_by_id" static? I mean something like this:</p>
  
  <pre><code>public static function find_by_id() {
     $result = self::$db-&gt;query('SELECT * FROM users WHERE id=2 LIMIT 1')-&gt;fetch(PDO::FETCH_ASSOC);
     return $result;
  }
  </code></pre>
  
  <p>And how do I execute it? I mean how to change this part:</p>
  
  <pre><code>$found = new mysql_a($db);
  $res = $found-&gt;find_by_id();
  echo $res['username'];
  </code></pre>
  
  <p>I can't figure it out and its driving me crazy... Any ideas?
  Thanks,
  Guu.</p>