12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- require "connectionDb.php";
- $selectDelivery1 = $db->query("SELECT * FROM delivery JOIN delivery_tank ON delivery.id=delivery_tank.delivery_id");
- $json_data=[];
- while ($row = $selectDelivery1->fetchArray()) {
- // print_r($row);
- $details = [
- "Action" => $row['type'],
- "Message" => $row['type'],
- "Id" => $row['id'],
- "Tank" => $row['tank_id'],
- "Status" => $row['status'],
- "Start" => dateFormatChanger($row['start']),
- "End" => dateFormatChanger($row['end']),
- "Product" => $row['product'],
- "SupplierId" => $row['supplier_id'],
- "SupplierName" => $row['product'],
- "DeliveryCarNumber" => $row['car_number'],
- "OrderPrice" => $row['order_price'],
- "OrderVolume" => $row['order_vol'],
- "DeliverVolume" => $row['deliver_vol'],
- "FuelPoints" => $row['fp_group'],
- "TankGroup" => $row['tank_group_id'],
- ];
- //here pushing the values in to an array
- array_push($json_data,$details);
- }
- $json_data_all = ["data" => $json_data];
- $myfile = fopen("api/v1/Deliveries/deliveryDetails.txt", "w+") or die("Unable to open file!");;
- fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));
- fclose($myfile);
- ?>
|