title: [] in postman response php
body: <pre><code>&lt;?php 
  
      require_once 'DbConnect.php';
  
      //an array to display response
      $response = array();
  
      //if it is an api call 
      //that means a get parameter named api call is set in the URL 
      //and with this parameter we are concluding that it is an api call
  
      if(isset($_GET['apicall'])){
  
          switch($_GET['apicall']){
  
              case 'signup':
                  //checking the parameters required are available or not 
                  if(isTheseParametersAvailable(array('username','email','password','gender'))){
  
                      //getting the values 
                      $username = $_POST['username']; 
                      $email = $_POST['email']; 
                      $password = md5($_POST['password']);
                      $gender = $_POST['gender']; 
  
                      //checking if the user is already exist with this username or email
                      //as the email and username should be unique for every user 
                      $stmt = $conn-&gt;prepare("SELECT id FROM users WHERE username = ? OR email = ?");
                      $stmt-&gt;bind_param("ss", $username, $email);
                      $stmt-&gt;execute();
                      $stmt-&gt;store_result();
  
                      //if the user already exist in the database 
                      if($stmt-&gt;num_rows &gt; 0){
                          $response['error'] = true;
                          $response['message'] = 'User already registered';
                          $stmt-&gt;close();
                      }else{
  
                          //if user is new creating an insert query 
                          $stmt = $conn-&gt;prepare("INSERT INTO users (username, email, password, gender) VALUES (?, ?, ?, ?)");
                          $stmt-&gt;bind_param("ssss", $username, $email, $password, $gender);
  
                          //if the user is successfully added to the database 
                          if($stmt-&gt;execute()){
  
                              //fetching the user back 
                              $stmt = $conn-&gt;prepare("SELECT id, id, username, email, gender FROM users WHERE username = ?"); 
                              $stmt-&gt;bind_param("s",$username);
                              $stmt-&gt;execute();
                              $stmt-&gt;bind_result($userid, $id, $username, $email, $gender);
                              $stmt-&gt;fetch();
  
                              $user = array(
                                  'id'=&gt;$id, 
                                  'username'=&gt;$username, 
                                  'email'=&gt;$email,
                                  'gender'=&gt;$gender
                              );
  
                              $stmt-&gt;close();
  
                              //adding the user data in response 
                              $response['error'] = false; 
                              $response['message'] = 'User registered successfully'; 
                              $response['user'] = $user; 
                          }
                      }
  
                  }else{
                      $response['error'] = true; 
                      $response['message'] = 'required parameters are not available'; 
                  }
  
              break; 
  
              case 'login':
                  //for login we need the username and password 
                  if(isTheseParametersAvailable(array('username', 'password'))){
                      //getting values 
                      $username = $_POST['username'];
                      $password = md5($_POST['password']); 
  
                      //creating the query 
                      $stmt = $conn-&gt;prepare("SELECT id, username, email, gender FROM users WHERE username = ? AND password = ?");
                      $stmt-&gt;bind_param("ss",$username, $password);
  
                      $stmt-&gt;execute();
  
                      $stmt-&gt;store_result();
  
                      //if the user exist with given credentials 
                      if($stmt-&gt;num_rows &gt; 0){
  
                          $stmt-&gt;bind_result($id, $username, $email, $gender);
                          $stmt-&gt;fetch();
  
                          $user = array(
                              'id'=&gt;$id, 
                              'username'=&gt;$username, 
                              'email'=&gt;$email,
                              'gender'=&gt;$gender
                          );
  
                          $response['error'] = false; 
                          $response['message'] = 'Login successfull'; 
                          $response['user'] = $user; 
                      }else{
                          //if the user not found 
                          $response['error'] = false; 
                          $response['message'] = 'Invalid username or password';
                      }
                  }
              break; 
  
              default: 
                  $response['error'] = true; 
                  $response['message'] = 'Invalid Operation Called';
          }
  
      }else{
          //if it is not api call 
          //pushing appropriate values to response array 
          $response['error'] = true; 
          $response['message'] = 'Invalid API Call';
      }
  
      //displaying the response in json structure 
      echo json_encode($response);
  
      //function validating all the paramters are available
      //we will pass the required parameters to this function 
      function isTheseParametersAvailable($params){
  
          //traversing through all the parameters 
          foreach($params as $param){
              //if the paramter is not available
              if(!isset($_POST[$param])){
                  //return false 
                  return false; 
              }
          }
          //return true if every param is available 
          return true; 
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VbnkD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VbnkD.png" alt="enter image description here"></a></p>
  
  <p>I keep getting [] in reponse of postman.What i am expecting is </p>
  
  <p><a href="https://i2.wp.com/www.simplifiedcoding.net/wp-content/uploads/2015/08/user-registration.png?w=954&amp;ssl=1" rel="nofollow noreferrer">https://i2.wp.com/www.simplifiedcoding.net/wp-content/uploads/2015/08/user-registration.png?w=954&amp;ssl=1</a></p>
  
  <p>Please help me.  I am trying to implement login functionality in my android app using php and as i am not aware of php, i am not sure what is wrong. Please help</p>