<?php
require_once('db.php');
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
$catagory= $_POST["catagoryKey"];
mysqli_set_charset($conn,'utf8');
$sql = "SELECT * FROM `dlof_item` WHERE category_code = '$catagory'ORDER BY id DESC";
    $run = mysqli_query($conn,$sql);
    while($data = mysqli_fetch_assoc($run)){
    	$item[] = $data ;
    	$json = json_encode(array('contents'=>$item));
    }
    echo $json ;


?>