1234567891011121314151617181920212223242526272829 |
- <?php
- require "connectionDb.php";
- $customers = $db->query("SELECT * FROM vehicle LEFT JOIN customer ON vehicle.customer_id=customer.id");
-
- $json_data=[];
- while ($row = $customers->fetchArray()) {
-
- $details = [
- "Customer_Id" => $row['customer_id'],
- "Id" => $row['id'],
- "Number" => $row['number'],
- ];
- array_push($json_data,$details);
- }
- $json_data_all = ["data" => $json_data];
- $myfile = fopen("api/v1/Customers/vehicles.txt", "w+") or die("Unable to open file!");;
- fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));
- fclose($myfile);
- ?>
|