<?php
header('content-type:application/x-javascript; charset=utf-8');
$con = mysqli_connect('localhost', 'cloudwps_cv', 'cooper@2019');
if (!$con) {

    die('Could not connect: ' . mysqli_error());

}
((bool)mysqli_query($con, "USE " . "cloudwps_coopervision"));  

$product = $_GET['p'];
$region = $_GET['r'];

mysqli_query($con, "SET NAMES 'utf8'");


$query = "SELECT id,shopname,area,address,phone,".$product." FROM hktrialcenter WHERE area LIKE '".$region."' AND ".$product."=1";

$result = mysqli_query($con, $query);
$rows = array();

while($r = mysqli_fetch_assoc($result)) {
    $rows[] = $r;
}
echo $_GET['callback'].'('.json_encode($rows).')';
