| 12345678910111213141516171819202122232425 | <?php     require "connectionDb.php";    $customers = $db->query("SELECT * FROM customer");$json_data=[];while ($row = $customers->fetchArray()) {    //print_r($row);$details = ["Customer_Id" => $row['id'],"Name" => $row['name'],"Credit_Sale" => ($row['credit_sale']==1)?"Yes":"No",];//here pushing the values in to an array  array_push($json_data,$details);  }$json_data_all = ["data" => $json_data];$myfile = fopen("api/v1/Customers/customers.txt", "w+") or die("Unable to open file!");;fwrite($myfile,json_encode($json_data_all, JSON_PRETTY_PRINT));fclose($myfile); ?>
 |