title: PDO can't access the database connection instance
body: <p>I have a database wrapper, and a static method to get PDO connection instance. Howewer, I can't access it when I want to make a PDO query.</p>
  
  <p><strong>Here is part of DB class:</strong></p>
  
  <pre><code>class DB {
  private static $_instance = null;
  private $_pdo,
          $_query,
          $_error = false,
          $_results,
          $_count =0;
  
  
  private function __construct() {
      try {
          $this-&gt;_pdo = new PDO('mysql:host='.Config::get('mysql/host').';dbname='.Config::get('mysql/db'),Config::get('mysql/username'),Config::get('mysql/password'));
  
      } catch (PDOException $e) {
          die($e-&gt;getMessage());
  
      }
  }
  
  public static function getInstance() {
      if(!isset(self::$_instance)) {
          self::$_instance = new DB();
  
      }
      return self::$_instance;
  }
  </code></pre>
  
  <p><strong>And here my query:</strong> </p>
  
  <pre><code>    $pdo = DB::getInstance();
  
      $statement = $pdo-&gt;prepare("select surname from staff_info where fname = :name");
      $statement-&gt;execute(array(':name' =&gt; Input::get('name')));
      $total = $statement-&gt;rowCount();
  
     while ($row = $statement-&gt;fetch(PDO::FETCH_ASSOC)) { 
              echo $row['surname'].'&lt;/br&gt;';
  
      }
  </code></pre>
  
  <p>But I am getting this error when i run the query:</p>
  
  <blockquote>
    <p>Fatal error: Call to undefined method DB::prepare() </p>
  </blockquote>
  
  <p>What I am doing wrong? Any help?</p>
  
  <p><strong>But this works when i do this way</strong></p>
  
  <pre><code>$dsn = 'mysql:host=localhost;dbname=cois';
  $user = 'root';
  $password = '';
  $pdo = new PDO($dsn, $user, $password);
  
  
  $filmName = "omar";
  
  $statement = $pdo-&gt;prepare("select surname from staff_info where fname = :name");
  $statement-&gt;execute(array(':name' =&gt; $filmName));
  $total = $statement-&gt;rowCount();
  
  while ($row = $statement-&gt;fetch(PDO::FETCH_ASSOC)) { 
        echo $row['surname'].'&lt;/br&gt;';
  
   }
  </code></pre>
  
  <p>How is this possible?</p>