title: PHP Checking if user exists with PDO
body: <p>I'm setting up a function in order to check if a passed username exists in the <code>users</code> table in my database. In order to do this, I'm using the following code:</p>
  
  <pre><code>function usernameCheck($username) {
      $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );
      $stmt = $con-&gt;prepare("SELECT username FROM users WHERE username = ':name'");
      $stmt-&gt;bindParam(':name', $username);
      $stmt-&gt;execute();
  
      if($stmt-&gt;rowCount() &gt; 0){
          echo "exists!";
      } else {
          echo "non existant";
      }
  }
  </code></pre>
  
  <p>However, no matter what I try setting as <code>$username</code>, I can't get any <code>exists!</code> back. I've tried changing it around to check for an additional column, like <code>userID</code>, but it still doesn't work. I think my syntax is correct, but I'm new to PDO so I'm probably missing something easy to fix.</p>
  
  <p>Thank you.</p>