title: Catchable fatal error: Object of class PDOStatement could not be converted to string
body: <p>I am getting the following error when attempting to match values on database with those passed in a form to check if a user exists.</p>
  
  <blockquote>
    <p>Catchable fatal error: Object of class PDOStatement could not be
    converted to string</p>
  </blockquote>
  
  <p>This is the code I'm using:</p>
  
  <pre><code>//Check users login details
      function match_login($username, $password){
              //If the button has been clicked get the variables
              try{
  
                  $dbh = new PDO("mysql:host=localhost;dbname=mjbox","root", "usbw");
  
              } catch( PDOException $e ) {
  
                  echo $e-&gt;getMessage();
  
              }
              $stmt = $dbh-&gt;prepare("SELECT * FROM mjbox WHERE username=? AND password=?");
              $stmt-&gt;bindParam(1, $username);
              $stmt-&gt;bindParam(2, $password);
              $stmt-&gt;execute();
  
              $result = mysql_query($stmt);
              if( mysql_num_rows($result) &gt; 0 ){
  
                  echo 'There is a match!';
              }else{
                  echo 'nooooo';
              }
      }
  </code></pre>