<?php
error_reporting(E_ALL ^ E_NOTICE ^E_WARNING);
$q = strtolower($_GET["q"]);
if (!$q) return;
include '../db_connect.php';




if($_GET['mode']=='prodcode'){
	
$items = mysqli_query($con,"SELECT  distinct(`gencode`) FROM prodreg");

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

else if($_GET['mode']=='consignee'){
	
$items = mysqli_query($con,"SELECT  distinct(`compid`) FROM commst where type = 'CONSIGNEE'");

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


mysqli_close($con);


?>
