<?php
header('Content-Type: application/json; charset=utf-8');
$conn = mysqli_connect('localhost', 'mfudevlo_batuawallet', 'batua@wallet6602#', 'mfudevlo_batuawalletdb');

// এই লাইনটি বাংলা সাপোর্ট নিশ্চিত করবে
mysqli_set_charset($conn, "utf8mb4");

$operator = isset($_GET['operator']) ? mysqli_real_escape_string($conn, $_GET['operator']) : 'GP';

$sql = "SELECT * FROM offers WHERE operator='$operator' AND status=1 ORDER BY price ASC";
$res = $conn->query($sql);

$data = array();
while($row = $res->fetch_assoc()){
    $data[] = $row;
}
echo json_encode($data);
?>