title: SELECT statement causing Call to a member function bind_param() on boolean on a working statement
body: <p>I have a working INSERT statement which allows a visitor to create an account on my website.</p>
  
  <p>I am trying to create a SELECT statement to check if the username they are trying to sign up with currently exists. For some reason, when the SELECT statement runs, I get a <code>Call to a member function bind_param() on boolean</code> on the INSERT statement (line 29).</p>
  
  <p>Why is this? I have provided my code...</p>
  
  <pre><code>&lt;?php
      require '../manager-session.php';
      require '../../db-config.php';
      require '../../distributor-config.php';
  
      $role = 'User';
      $title = $_POST['title'];
      $firstname = $_POST['firstname'];
      $surname = $_POST['surname'];
      $company = $_SESSION['userinfo']['company'];
      $emailaddress = $_POST['emailaddress'];
      $telephone = $_POST['telephone'];
      $addressline1 = $_POST['addressline1'];
      $addressline2 = $_POST['addressline2'];
      $addressline3 = $_POST['addressline3'];
      $towncity = $_POST['towncity'];
      $county = $_POST['county'];
      $postcode = $_POST['postcode'];
      $username = $_POST['username'];
      $password = $_POST['password'];
  
      $stmt_check = "SELECT username FROM users WHERE username = ?";
      $stmt_check = $conn-&gt;prepare($stmt_check);
      $stmt_check-&gt;bind_param('s', $_POST['username']);
      $stmt_check-&gt;execute();
  
      if($stmt_check == true) {
          $stmt = $conn-&gt;prepare("INSERT INTO users (role, distributor, company, title, firstname, surname, emailaddress, telephone, addressline1, addressline2, addressline3, towncity, county, postcode, username, password) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
          $stmt-&gt;bind_param("ssssssssssssssss", $role, $distributor, $company, $title, $firstname, $surname, $emailaddress, $telephone, $addressline1, $addressline2, $addressline3, $towncity, $county, $postcode, $username, $password);
          $stmt-&gt;execute();
  
          $to = "". $emailaddress ."";
          $subject = "New User Account";
          $txt = "". $firstname ." ". $surname ." has created a new User account for ". $distributor .". Please login using the following details:\n\nUsername: ". $username ."\nPassword: ". $password ."";
          $headers = "From: removed@email.com" . "\r\n" . "BCC: removed@email.com, removed@email.com ". $distributoremail ."";
          mail($to, $subject, $txt, $headers);
  
          header('location: ../add-a-new-user.php?page=add-a-new-user&amp;status=success');
          exit();
      }
  
      else {
          header('location: ../add-a-new-user.php?page=add-a-new-user&amp;status=error');
          exit(); 
      }
  
      $stmt-&gt;close();
      $conn-&gt;close();
  ?&gt;
  </code></pre>