<?php 
	include 'config.inc.php';
	
	$sql = "SELECT * FROM tblCafea;";
	
	$result = mysqli_query($conn,$sql);
	
	$response = array();


$sqlVer = "SELECT * FROM tblVersionare";

$resultVer = mysqli_query($conn,$sqlVer);

//echo $rowVer = mysqli_fetch_row($resultVer);

//array_push($response,array("Version"=>"1"));

while ($rowVer = mysqli_fetch_row($resultVer))
{
    $ver = $rowVer[1];
}

//echo "a".$ver;



array_push($response,array("Version"=>$ver));

	while ($row = mysqli_fetch_array($result)) 
	{
		array_push($response, array("ID"=>$row[0],"Denumire"=>$row[1],"Origine"=>$row[2]));
	}


/*	$jsonResp = json_encode(array("server_response"=>$response));
	$jsonRespVer = json_encode(array("version"=>$jsonResp));

	echo $jsonRespVer;*/


    echo "<pre>";
	echo json_encode(array("server_response"=>$response), JSON_PRETTY_PRINT);
    echo "</pre>";

	//echo json_encode($response);

	
	mysqli_close($conn);

?>