updatePricesData.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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 price_update");
  6. $json_data=[];
  7. while ($row = $customers->fetchArray()) {
  8. //print_r($row);
  9. $details = [
  10. "Id" => $row['id'],
  11. "Status" => $row['status'],
  12. "Timing" => $row['timing'],
  13. "Create_At" => date('Y-M-d h:i:s A',$row['created_at']),
  14. "Update_At" => date('Y-M-d h:i:s A',$row['updated_at']),
  15. // "Grade_Id" => $row['grade_id'],
  16. // "Grade_Text" => $row['grade_text'],
  17. // "Grade_Price" => $row['grade_price'],
  18. // "New_Grade_Price" => $row['new_grade_price'],
  19. ];
  20. //here pushing the values in to an array
  21. array_push($json_data,$details);
  22. }
  23. $json_data_all = ["data" => $json_data];
  24. $myfile = fopen("api/v1/Update_Prices/updatePricesData.txt", "w+") or die("Unable to open file!");;
  25. fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));
  26. fclose($myfile);
  27. // }
  28. ?>