Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- $hostname = "host";
- $user = "user";
- $password = "****";
- $database = "BD";
- $db = mysqli_connect($hostname, $user, $password) or die("Opps some thing went wrong");
- mysqli_select_db($database, $db) or die("Opps some thing went ERROR 2");
- // array for JSON response
- $response = array();
- // get all items from myorder table
- $result = mysqli_query("SELECT * FROM escolar_tracker ") or die(mysqli_error());
- if (mysqli_num_rows($result) > 0) {
- $response["rutas"] = array();
- while ($row = mysqli_fetch_array($result)) {
- // temp user array
- $item = array();
- $item["id"] = $row["id"];
- $item["ruta"] = $row["ruta"];
- $item["jornada"] = $row["jornada"];
- // push ordered items into response array
- array_push($response["rutas"], $item);
- }
- // success
- $response["success"] = 1;
- }
- else {
- // order is empty
- $response["success"] = 0;
- $response["message"] = "No Items Found";
- }
- // echoing JSON response
- echo json_encode($response);
- ?>
Add Comment
Please, Sign In to add comment