<?php
error_reporting(1);
ini_set('display_errors', 1);
require_once 'database.php';
class getSubCategory extends database
{
    public function getAllSubCategories($categoryID)
    {
    	$where['cat_id'] = $categoryID;
    	return $this->fetchAll('subcategory', $where);
    }
}


if(!isset($_GET['categoryID']) || !is_numeric($_GET['categoryID']))
{
	http_response_code(400);
	echo json_encode(['error_text' => 'No input Found']);
	exit;
}

$categoryID = $_GET['categoryID'];

$obj = new getSubCategory();
$categories = $obj->getAllSubCategories($categoryID);

http_response_code(200);
echo json_encode($categories);