updatePricesData.php 1020 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. require "connectionDb.php";
  3. // if (isset($_POST['find'])) {
  4. // $customers = $db->query("SELECT * FROM price_update JOIN grade_price_update ON price_update.id=grade_price_update.price_update_id");
  5. $customers = $db->query("SELECT * FROM price_update");
  6. $json_data=[];
  7. while ($row = $customers->fetchArray()) {
  8. // var_dump($row);
  9. $details = [
  10. "Id" => $row['id'],
  11. "Status" => $row['status'],
  12. "Timing" => $row['timing'],
  13. "Create_At" => dateFormatChanger($row['created_at']),
  14. "Update_At" => dateFormatChanger($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/UpdatePrices/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. ?>