title: PDO:: What's wrong with this query?
body: <p>Method in my class does it work properly. Don't give me some error message, but simply does not work.</p>
  
  <pre><code>        public function query($value)
              {
                  $this-&gt;__error = FALSE;
  
                          $sql = "SELECT * FROM users WHERE username = ".Input::input($value);
  
                          if ($this-&gt;__query = $this-&gt;__pdo-&gt;query($sql))
                          {
                               $this-&gt;__result = $this-&gt;__query-&gt;fetchAll(PDO::FETCH_OBJ);
                      $this-&gt;__count = $this-&gt;__query-&gt;rowCount(); //Here is the problem
  
                          }
  
  
                      else {
                      $this-&gt;__error = TRUE;
       }   
       return $this;
                  }
  
       public function count()
              {
                  return $this-&gt;__count;
    }
  </code></pre>
  
  <p>But I would not write whole class code, I mention that PDO DataBase connection is properly defined (<strong>$_<em>pdo property</strong>), also the instance who is responsible to comunicate with database. (<strong>$</em>_instance property</strong>). Input class too.</p>
  
  <p>Here is my index.php (some kind of registration form):</p>
  
  <pre><code>    &lt;?php 
  
      spl_autoload_register(function($class) //Load all class in project
      {
         require_once 'class/'.$class.'.php';
      }
          );
  
      $user = DataBase_class::instance()-&gt;query("username"); //username is the name of textbox
  
      if ($user-&gt;count())
      {
          echo 'User exist';
      }
      else echo 'User not exist';
  ?&gt; 
  </code></pre>
  
  <p>Result is "User not exist", although user exist 100%.</p>