<?php
header("Access-Control-Allow-Origin: *");
include("config.php");
if(isset($_GET["sql"])){
	$consulta = $_GET["sql"];
}else{
	$consulta = $_POST["sql"];
}

$sql = mysql_query($consulta) or die(mysql_error());
while($r = mysql_fetch_assoc($sql)){
	$datos["data"][]=$r;
}

echo json_encode($datos);
mysql_close($con);
?>