Exemplo n.º 1
0
 function getSharedServerJSONData($sql)
 {
     $db = new interactDatabase();
     $conn = $db->dbinteraction();
     $arr = array();
     $result = mysqli_query($conn, $sql);
     $totalrecords = mysqli_num_rows($result);
     while ($row = mysqli_fetch_assoc($result)) {
         $arr[] = $row;
     }
     $json = json_encode($arr, true);
     $conn->close();
     return $json;
 }
Exemplo n.º 2
0
 function getJSONData($sql)
 {
     $db = new interactDatabase();
     $conn = $db->dbinteraction();
     $result = mysqli_query($conn, $sql);
     $json = "";
     if (!$result) {
         die("Invalid query: " . mysqli_error($conn));
         $this->logger->error("Query(Status-Invalid) : " . $sql);
     } else {
         $rows = array();
         while ($row = $result->fetch_assoc()) {
             $rows[] = $row;
         }
         $json = json_encode($rows);
     }
     mysqli_free_result($result);
     $conn->close();
     return $json;
 }