<?php
	session_start();
	require('includes/config.php');	
	if( ( $_REQUEST["type"] ) == "child"  )	{				
		$query = "SELECT child_id, sub_category_name FROM child_categories WHERE active = 1";
		$result = mysqli_query( $con,$query );
		$cnt = mysqli_num_rows( $result );
		$data =  array();
		if( $cnt > 0 ) {
			while( $rows = mysqli_fetch_assoc($exe) ){
				array_push( $data, [ 'id'=> $rows['id'], 'name' => $rows['sub_category_name'] ] );
			}
			echo json_encode( ['code' => 200,'data' => $data ] ); exit;
		}else{
			echo json_encode( ['code' => 404, 'data' => 'No data Found!' ] ); exit;
		}
	}else{
		echo json_encode( ['code' => 404, 'data' => 'Error occured' ] ); exit;
	}
?>