<?php

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

$items = mysqli_query($con,"select compid,name,address,cmpcity,email,telephone,fax	 from commst ");

//while($row = mysql_fetch_array($items))
 // {
 // echo $row['value'];
 
//  }
if($_GET['type']=='buyc')
{
while($row = mysqli_fetch_array($items)) {
	if (strpos(strtolower($row['compid']), $q) !== false) {
		
		echo "$row[compid]|$row[name]|$row[address]|$row[cmpcity]|$row[email]|$row[telephone]|$row[fax]|buyc\n";
		
	
		
}
}
}
else
{
	while($row = mysqli_fetch_array($items)) {
	if (strpos(strtolower($row['name']), $q) !== false) {
		
	
		
		echo "$row[name]|$row[compid]|$row[address]|$row[cmpcity]|$row[email]|$row[telephone]|$row[fax]\n";
		
	}
	
	}
}


mysqli_close($con);


?>