title: I am getting syntax error, unexpected 'header' (T_STRING) in http://localhost:80/opt/lampp/htdocs/user_control.php
body: <p>I am trying for user login and registration forms in Android. From past 5 days, I am trying it. I am not able to get it. Can anyone help me please? This is my code <code>user_control.php</code>. I am including the <code>connection.php</code> in <code>user_control.php</code>.</p>
  
  <pre><code>&lt;? php
  
      class user {
      private $db;
      private $connection;
      /* The below one is the consttructor*/
      function __construct() {
          header('Content-Type: application/json'); /* used for including json format*/
          require_once 'connection.php';
          $this-&gt;db = new DB_Connection();
          $this-&gt;connection = $this-&gt;db-&gt;get_connection();
      }
  
      public function does_user_exist($email,$password) {
          $query = "Select * from userss where email ='$email' and password = '$password'";
          $result = mysqli_query($this-&gt;connection,$query);
          if(mysqli_num_rows($result) &gt; 0){
              $json['success'] = 'welcome'.$email;
              echo json_encode($json);
              mysqli_close($this-&gt;connection);
          } else {
              $query = " Insert into userss(email,password) values ('$email','$password')";
              $is_inserted = mysqli_query($this-&gt;connection, $query);
              if($is_inserted == 1) {
                  $json['success'] = 'Account created, welcome '.$email;
              } else {
                  $json['error'] = 'Wrong password';
              }
  
              echo json_encode($json);
              mysqli_close($this-&gt;connection);
          }
      }
  }
  
      $user = new user();
      if(isset($_POST['email'],$_POST['password'])) {
      $email = $_POST['email'];
      $password = $_POST['password'];
      if(!empty($email) &amp;&amp; !empty($password)) {
          $encrypted_password = md5($password);
          $user -&gt; does_user_exist($email,$encrypted_password);
      } else {
          echo json_encode("You must fill both fields");
  
      }
      }
  </code></pre>
  
  <p>While I am running with postman software by Chrome I am getting the error as I am getting syntax error:</p>
  
  <pre><code>unexpected 'header' (T_STRING) in   http://localhost:80/opt/lampp/htdocs/user_control.php
  </code></pre>