title: Two query's and I get a completely blank screen, error reporting shows nothing
body: <p>I have seen a few other questions about this problem but I believe mine to be unique. I am processing a form and am relatively new to PHP and PDO so do not have the best debugging skills. I believe that my query's are wrong, as when I press the submit button on my form it just throws up a blank page with no error messages (even though I have error reporting on).</p>
  
  <p>I started writing this in MySqli but then had to scrap it as it was not working and I needed to easily have variables inside my Insert statements. Here is my code</p>
  
  <pre><code>error_reporting(-1);    
  
         require 'scripts/PasswordHash.php';
         $username = $name = $email = $password = $gender = $age = '';
         $query = FALSE;
         $dbh = new PDO('mysql:host=localhost;dbname=some_database;charset=utf8', 'some_user', 'some_password');
  
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             //Logic
              if (empty($_POST['age'])) {
                 $errors[] = 'Please enter your age';
             }
  
             if (empty($_POST['gender'])) {
                 $errors[] = 'Please select your gender';
             }
  
             if ($_POST['password'] != $_POST['passwordRep']) {
                 $errors[] = 'You did not repeat your password properly';
             }
  
             if (empty($_POST['password'])) {
                 $errors[] = 'Please enter a password';
             }
  
             if (empty($_POST['email'])) {
                 $errors[] = 'Please enter your email in this format : xxxxx@xxx.xxx or xxxxx@xxx.xx.xx';
             }
  
             if (empty($_POST['name'])) {
                 $errors[] = 'Please enter your name';
             }
             if (check("username", $_POST['username']) == TRUE) {
                 $errors[] = 'That username already exists';
             }
             if (check("email", $_POST['email']) == TRUE) {
                 $errors[] = 'That username already exists';
             }
  
             if (empty($_POST['username'])) {
                  $errors[] = 'Please enter a username';
             }
  
             if (empty($errors)) {
                 $username = trim($_POST['username']);
                 $name = trim($_POST['name']);
                 $email = trim($_POST['email']);
                 $password = PassHash::hash($_POST['password']);
                 $gender = trim($_POST['gender']);
                 $age = trim($_POST['age']);
                 $date = date("Y-m-d H:i:s");
                 $hash = md5( rand(0,1000) );
                 insert();
             }
         }
  
  
         function insert() {
             try {
                  //connect as appropriate as above
                  $sql= "INSERT INTO users VALUES(:username, :password, :name, :email, :date, :age, :gender, :hash)"; 
                  $stmt = $dbh-&gt;prepare($sql);
                  $stmt-&gt;bindParam(':username', $username, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':password', $password, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':name', $name, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':email', $email, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':date', $date, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':age', $age, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':gender', $gender, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':hash', $hash, PDO::PARAM_STR);
                  $stmt-&gt;execute();
                  $query = TRUE;
                  require 'scripts/sendEmailVerify.php';
              } catch(PDOException $ex) {
                  echo "An Error occured!"; //user friendly message
                  echo ($ex-&gt;getMessage());
              }
         }
  
         function check($field, $input) {
             try {
                  $sql= "SELECT :field FROM users WHERE :field = :input"; 
                  $stmt = $dbh-&gt;prepare($sql);
                  $stmt-&gt;bindParam(':field', $field, PDO::PARAM_STR);
                  $stmt-&gt;bindParam(':input', $input, PDO::PARAM_STR); 
                  $stmt-&gt;execute();
  
                  $row_count = $stmt-&gt;rowCount();
                  if ($row_count &gt; 0) {
                      return TRUE;
                  } else {
                      return FALSE;
                  }
  
              } catch(PDOException $ex) {
                  echo "An Error occured!"; //user friendly message
                  echo ($ex-&gt;getMessage());
              }
         }
  </code></pre>
  
  <p>I think it may be that I have the query's happening in functions (although I do not know). I have run this code through PHP code checker (<a href="http://phpcodechecker.com/" rel="nofollow">http://phpcodechecker.com/</a>) and it is fine so I don't think it is my syntax! Thanks,</p>
  
  <p>Nick</p>
  
  <p>EDIT: I have located the error thanks to the links about debugging!</p>