title: PHP Validation user exists using PDO
body: <p>I have this form and start by checking if the fields are empty and it works pretty well. My question here is: why do i get errors when I want to verify if user exists? 
  Here is my code: </p>
  
  <pre><code>&lt;?php 
  require_once '../../includes/database.php';
  require '../../includes/functions.php';
  
  if($_SERVER['REQUEST_METHOD'] == 'POST') {
      $username = $_POST['username'];
      $password = $_POST['password'];
      $repassword = $_POST['re-password'];
      $conn = connect($config);
  
      if(empty($username) || empty($password) || empty($repassword)) {
          $status = 'Fields must not be empty';
      }
  
      $results = $conn-&gt;query("SELECT * FROM admin WHERE username = " . $username);
      foreach($results as $result) {
          print_r($result);
      }
  }
  include 'staff_create.view.php';
  </code></pre>