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

$myJSON["catgoryone"]= array();
$myJSON["catgorytwo"]= array();
$myJSON['success']="0";
if(isset($_POST["nekot"]) && isset($_POST["an1d"]))
{
    $connect = @mysqli_connect($hostname,$username,$password,$database);
    if($connect)
    {
        @mysqli_query($connect,"SET CHARACTER SET utf8;");

        $query_one = "SELECT * FROM ".$tbl_category." ORDER BY sort,catname";
  			$oneres = @mysqli_query($connect,$query_one);
  			if($oneres){
  			 while($row = @mysqli_fetch_assoc($oneres)){
          array_push($myJSON["catgoryone"], $row);
  			 }
         $query_two = "SELECT * FROM ".$tbl_category1." ORDER BY sort,cat1name";
         $twores = @mysqli_query($connect,$query_two);
         if($twores){
          while($row1 = @mysqli_fetch_assoc($twores)){
           array_push($myJSON["catgorytwo"], $row1);
          }
          $myJSON['success']="200";
         }
         else {
           $myJSON['success']=@mysqli_error($connect);
         }
  			}
			else
				$myJSON['success']=@mysqli_error($connect);
	}
	 else
		 $myJSON['success']=@mysqli_error($connect);
}

echo json_encode($myJSON);
?>
