<?php
	//apstrādā pieprasijumu un ja vajag iedot rezultātu
	header('Content-type: application/json');
	$path="./";
	include_once($path."config.php");
	if(isset($_GET["q"]) ){
		include_once($path.trim($_GET["q"]).".php");
		$result = $connn->query($sql);
		$outp=array();
		while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
			array_push($outp,$rs);
		}
		echo json_encode($outp);
	}
	if(isset($_GET["v"]) ){
		include_once($path.trim($_GET["v"]).".php");
		$result = $connn->query($sql);
		$outp=array();
		//while(
		$rs = $result->fetch_array(MYSQLI_ASSOC);//) {
		//	array_push($outp,$rs);
		//}
		echo($rs['json']);
	}
if(isset($_GET["d"]) ){
	include_once($path.trim($_GET["d"]).".php");
	$result = $connn->query($sql);
	}
	
	$connn -> close();
?>
