title: return all rows in json format
body: <p>Good day. I want to return all the rows in my database table and return it in json format, but my current code will only return a single row. I tried to 
   changed $stmt->get_result()->fetch_assoc();
   to fetch_all(); sad to say it returns an error.</p>
  
  <p>Hope you can help me guys.</p>
  
  <p>db_func.php</p>
  
  <pre><code>public function  getBrnchInfo($br_code){
      $stmt = $this-&gt;conn-&gt;prepare("SELECT branches.BranchesID as 'br_id', branches.BranchesDesc as 'br_desc', branches.Address as 'br_add', branches.Manager as 'br_manager', branches.ACRONYM as 'br_accronym', semaphor.semTransactionDate as 'br_trans_date'
                      FROM branches
                      LEFT JOIN semaphor ON SemBR_CODE = BranchesID
                      WHERE BranchesID= ?");
  
      $stmt-&gt;bind_param("i", $br_code);
  
      if ($stmt-&gt;execute()) {
          $userData = $stmt-&gt;get_result()-&gt;fetch_assoc();
          $stmt-&gt;close();
  
          return $userData;
      }else {
          return NULL;
      }
  }
  </code></pre>
  
  <p>branch.php</p>
  
  <pre><code>$user = $db-&gt;getBrnchInfo($br_code);
  //var_dump($user);
  if ($user != null) {
      $response["error"] = FALSE;
      $response["user"]["ar_class"] = $arclass;
      $response["user"]["loan_class"] = $loanclass;
      $response["user"]["accnt_receivable"] = $accintreceivable;
      $response["user"]["br_code"] = $user["br_id"];
      $response["user"]["br_desc"] = $user["br_desc"];
      $response["user"]["br_address"] = $user["br_add"];
      $response["user"]["br_manager"] = $user["br_manager"];
      $response["user"]["br_accronym"] = $user["br_accronym"];
      $response["user"]["br_trans_date"] = $user["br_trans_date"];
     // echo json_encode($response, true);
  }
  else {
      echo "Branch Code ". $br_code. " does not exist in " . "&lt;strong&gt;Table Branch&lt;/strong&gt;";
  }
  </code></pre>