title: Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\PMSS\login.php on line 95
body: <p>This is my Login.php</p>
  
  <pre><code>&lt;?php
  
  //load and connect to MySQL database stuff
  require("config.inc.php");
  
  if (!empty($_POST)) {
  
      if(empty($_POST['username']) || empty($_POST['password'])) {
  
          $response["success"] = 0;
          $response["message"] = "Please fill in the login details!";
          die(json_encode($response));
      }
  
      $query = "SELECT  email, password, position FROM user   WHERE   email = :email ";
  
      $query_params = array(':email' =&gt; $_POST['username'],);
  
      try {
          $stmt   = $db-&gt;prepare($query);
          $result = $stmt-&gt;execute($query_params);
      }
      catch (PDOException $ex) {
      // For testing, you could use a die and message. 
      //die("Failed to run query: " . $ex-&gt;getMessage());
  
      //or just use this use this one to product JSON data:
          $response["success"] = 0;
          $response["message"] = "Database Error1. Please Try Again!";
          die(json_encode($response));
  
      }
  
      //This will be the variable to determine whether or not the user's information is correct.
      //we initialize it as false.
      $validated_info = false;
      $login_ok = false;
  
      //fetching all the rows from the query
      $row = $stmt-&gt;fetch();
      if ($row) {
          //if we encrypted the password, we would unencrypt it here, but in our case we just
          //compare the two passwords
          if ($_POST['password'] === $row['password']) {
              $login_ok = true;       
          }
  
      // If the user logged in successfully, then we send them to the private members-only page 
      // Otherwise, we display a login failed message and show the login form again 
          if ($login_ok) {
              $response["success"] = 1;
              $response["message"] = "Login Successful!";
              $response["posts"]   = array();
  
                  foreach ($row as $rerow) {
                  $row = array(
                  $post["position"] = $rerow["position"]
                              );
  
                  array_push($response["posts"], $post);
                  }
  
                  die(json_encode($response));
          } 
          else {
              $response["success"] = 0;
              $response["message"] = "Invalid Credentials!";
              die(json_encode($response));
          }
  
      } 
  }   
  else {
      ?&gt;
      &lt;h1&gt;Login&lt;/h1&gt; 
      &lt;form action="login.php" method="post"&gt; 
          Username:&lt;br /&gt; 
          &lt;input type="text" name="username" placeholder="username" /&gt; 
          &lt;br /&gt;&lt;br /&gt; 
          Password:&lt;br /&gt; 
          &lt;input type="password" name="password" placeholder="password" value="" /&gt; 
          &lt;br /&gt;&lt;br /&gt; 
          &lt;input type="submit" value="Login" /&gt; 
      &lt;/form&gt; 
      &lt;a href="register.php"&gt;Register&lt;/a&gt;
      &lt;?php
  }
  ?&gt; 
  </code></pre>
  
  <p>I not sure which place I didn't put close bracket. Can you all help me check out see? I not sure where to put the close bracket. Is is anything to do with my condition while retrieving my data to my android? If it is, please state it out as for me to know the syntax I write was correct or not.</p>