<?php

$q = strtolower($_GET["q"]);
if (!$q) return;
include 'db_connect.php';

if($_GET['mode']=='department'){
	
	$items = mysqli_query($con,"SELECT `desc` FROM master where mstype like 'DEPT'");


	while($row = mysqli_fetch_array($items)) {
	//if (strpos(strtolower($row['desc']), $q) !== false) {
		echo $row['desc']."\n";
  //}
	}
}

else
{
$items = mysqli_query($con,"SELECT code, det FROM master where mstype like 'SUP'");


while($row = mysqli_fetch_array($items)) {
	//if (strpos(strtolower($row['code']), $q) !== false) {
		echo $row['code']."|".$row['det']."\n";
  	 //}
  }
}
mysqli_close($con);


?>