fuelPointsData.php 969 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. require "connectionDb.php";
  3. // if (isset($_POST['find'])) {
  4. // $customers = $db->query("SELECT * FROM price_update LEFT JOIN grade_update_prices ON grade_update_prices.price_update_id=price_update.id");
  5. $customers = $db->query("SELECT * FROM fp_config");
  6. $json_data=[];
  7. while ($row = $customers->fetchArray()) {
  8. $auto_clear = ($row['auto_clear_transaction']==0) ? false : true;
  9. //print_r($row);
  10. $details = [
  11. "Id" => $row['id'],
  12. "Create_At" => date('Y-M-d h:i:s A',$row['created_at']),
  13. "Update_At" => date('Y-M-d h:i:s A',$row['updated_at']),
  14. "Auto_Clear_Transaction" => $auto_clear,
  15. "Status" => $row['status'],
  16. "TankIds" => $row['tank_ids'],
  17. ];
  18. //here pushing the values in to an array
  19. array_push($json_data,$details);
  20. }
  21. $json_data_all = ["data" => $json_data];
  22. $myfile = fopen("api/v1/FuelPoints/fuelPointsData.txt", "w+") or die("Unable to open file!");;
  23. fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));
  24. fclose($myfile);
  25. // }
  26. ?>