title: PHP code failing query
body: <p>I am working on a php code that processes the lookup of three variables, $email, $password, and $address. The user will input their current email, password, and a NEW address they want to update in the system. 
  [this is the html form][1]
      The query is executing this part of the if statement:
      <code>enter code here</code>$body .= "Invalid email: $inputemail";</p>
  
  <p>How come it is saying invalid email though I entered the correct info? I am new to coding so I  am having trouble figuring out what the problem is. Also, I debugged using <code>var_dump($db-&gt;errorInfo());</code> and it returned array (size=3)</p>
  
  <pre><code> 0 =&gt; string '' (length=0)
    1 =&gt; null
    2 =&gt; null
  
      &lt;?php
  include_once('support.php');
  include_once('connect_database.php');
  //connect_database.php contains your connection/creation of a PDO to connect to your MYSQL db on bmgt406.rhsmith.umd.edu/phpmyadmin
  ini_set("display_errors","1");
  error_reporting(E_ALL);
  
  
  // Initialize $title and $body.
  $title = "Simple Update Request";
  $body = "&lt;fieldset&gt;&lt;legend&gt;" .$title . "&lt;/legend&gt;";
  
  // Initialize variables with values for the name of the table ($name_of_table)
  // and the 3 fields - email, password, and address using method GET.
  $name_of_table = "requests";
  
  $inputemail = $_GET['email'];
  $inputpassword = $_GET['password'];
  $address = $_GET['address'];
  var_dump($db-&gt;errorInfo());
  
  // Check if the table exists in the db
  if (tableExists($db, $name_of_table)) 
  { 
      // Prepare a SQL select query and bind the 3 variables to email, password, and address fields in your database. 
  
      $sqlQuery = "SELECT * FROM $name_of_table WHERE email = :email";
      $statement1 = $db-&gt;prepare($sqlQuery);
  
      $statement1-&gt;bindValue(':email', $inputemail, PDO::PARAM_STR);
  
      // Execute the SQL query and store in $result
      $result =  $statement1-&gt;execute();
  
      if (!$result) {
          // Retrieving records failed.
          $body .= "Retrieving records from table " . $name_of_table . " failed. &lt;br/&gt;";
      } else {
          // Retrieving records successful.
          // Retrieve result into $singleRow using fetch();
          $singleRow = $statement1-&gt;fetch();
  
          if (!$singleRow){
              // Invalid email address has been entered.
              $body .= "Invalid email: $inputemail";
          } else {
              if ($singleRow['password'] != $inputpassword) {
                      // If the password is not the same as $inputpassword, then an "Invalid Password" has been entered.
                  $body .= "Invalid password.";
                      // Get current value from table before UPDATING the user's new address.
                  } else {
                      $address = $singleRow['address'];
  
                      // Close previous SQl query connection before starting a new query. 
                      $statement1-&gt;closeCursor();
  
                      // Prepare a SQL Query to update the user information and execute the query.
                      $sqlQuery = "UPDATE " . $name_of_table . " SET email= :email, password= :password WHERE address= :address";
                      $statement1 = $db-&gt;prepare($sqlQuery);
      $statement1-&gt;bindValue(':address', $address, PDO::PARAM_STR);
      $statement1-&gt;bindValue(':email', $inputemail, PDO::PARAM_STR);
      $statement1-&gt;bindValue(':password', $inputpassword, PDO::PARAM_STR);
  
      // Execute the SQL query and store in $result
      $result =  $statement1-&gt;execute();
                      // If everything is correct, display the UPDATED user information found (firstname, lastname, address, email, plan)
  
  
          }
      }
  
      $statement1-&gt;closeCursor(); 
  
  }
  }
  
  $body .= "&lt;a href=\"index.html\"&gt;&lt;input type=\"submit\" value = \"Main Menu\"/&gt;&lt;/a&gt;";
  $body .= "&lt;/fieldset&gt;";
  
  echo generatePage($title,$body);
  
  ?&gt;
  </code></pre>