Add the flight search and booking features.
[Project_webapp.git] / lib / db.php
index c7c2d48c71f9cb45e756b1151576b7e125e36c1a..cd9b0825331a60c40b9c9a6d23590c487ffa8cd6 100644 (file)
@@ -80,6 +80,7 @@ class CustomDB
 
     /**
      * [prepared_query_bind_param description]
+     * @param  [type] $types  [description]
      * @param  [type] $params [description]
      * @return [type]         [description]
      */
@@ -116,9 +117,18 @@ class CustomDB
 
     public function get_result_array()
     {
-        $rt_val = $this->current_result->fetch_array();
-        if (!$rt_val) {
+        $row = $this->current_result->fetch_array();
+        if (is_null($row)) {
+            $rt_val = [];
+        } elseif (!isset($row)) {
             echo "Fail to build SQL query result array : (" . $this->current_stmt->errno . ") " . $this->current_stmt->error . " - " . $this->current_pquery . "<br>";
+            $rt_val = false;
+        } else {
+            $rows[] = $row;
+            while ($row = $this->current_result->fetch_array()) {
+                $rows[] = $row;
+            }
+            $rt_val = $rows;
         }
         return $rt_val;
     }
@@ -136,4 +146,5 @@ class CustomDB
         return $rt_val;
     }
 }
+
 ?>