<?php 
    require "connectionDb.php";
// if (isset($_POST['find'])) {
    
// $customers = $db->query("SELECT * FROM price_update LEFT JOIN grade_update_prices ON grade_update_prices.price_update_id=price_update.id");
$customers = $db->query("SELECT * FROM fp_config");

$json_data=[];

while ($row = $customers->fetchArray()) {
$auto_clear = ($row['auto_clear_transaction']==0) ? false : true;
//print_r($row);
$details = [
"Id" => $row['id'],
"Create_At" => date('Y-M-d h:i:s A',$row['created_at']),
"Update_At" => date('Y-M-d h:i:s A',$row['updated_at']),
"Auto_Clear_Transaction" => $auto_clear,
"Status" => $row['status'],
"TankIds" => $row['tank_ids'],
];
//here pushing the values in to an array  
array_push($json_data,$details);  
}
$json_data_all = ["data" => $json_data];

$myfile = fopen("api/v1/FuelPoints/fuelPointsData.txt", "w+") or die("Unable to open file!");;
fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));
fclose($myfile);
// }
 ?>