HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/nclive/backend/institute_get_category.php
<?php
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json');
include "config.php";

	$getInstCatQuery="SELECT inst.category_id, count(inst.id) as count, ic.category_name FROM sp_institutions as inst INNER JOIN sp_institutions_category as ic ON ic.id=inst.category_id WHERE inst.status='1' group by inst.category_id order by ic.display_order ";	

	$sqlInstCat=$db->prepare($getInstCatQuery);
	$sqlInstCat->execute();

	$instCatDataArray = array();
	while($rowInstCat=$sqlInstCat->fetch()){	
		$category_id= $rowInstCat['category_id'];
		$inst_count= $rowInstCat['count'];
		$category_name = $rowInstCat['category_name'];
		
		$instCatArray=array("category_id"=>$category_id, "category_name"=>$category_name, "inst_count"=>$inst_count);
		$instCatDataArray[]=$instCatArray;
	}	

	echo json_encode($instCatDataArray , TRUE);

?>