<?php
require_once ("varables.php");

$myJSON['products'] = array();
$myJSON['success']="0";
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
{
    $id = $_POST["an1d"];
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8mb4;");
		
			$query_all = "SELECT * FROM ".$tbl_products.",tbl_bnrproducts WHERE ".$tbl_products .".id = tbl_bnrproducts.proId  AND tbl_bnrproducts.bnrId = '".$id."' ORDER BY P_name";
			$allres = @mysqli_query($connect,$query_all);
			if($allres){
			 while($row = @mysqli_fetch_assoc($allres))
				array_push($myJSON["products"], $row);
				$myJSON['success']="200";
			}		
	}
	 else
		 $myJSON['success']="402";
}
echo json_encode($myJSON);
?>