<?php
header('content-type:application/x-javascript; charset=utf-8');
$con = mysql_connect('localhost', 'webpuppi_cv', 'coopervision111');
if (!$con) {
    die('Could not connect: ' . mysql_error());
}
mysql_select_db('webpuppi_cv', $con) or die(mysql_error());

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

mysql_query("SET NAMES 'utf8'");


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

$result = mysql_query($query);
$rows = array();

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