<?php 
require_once('Connections/localhost.php'); 
mysql_select_db($database_localhost,$localhost);
$productID = $_POST['productID'];
$productType = $_POST['productType'];
if($productType == "productID"){
	$query1 = mysql_query("select * from tbl_product where product_ID = '$productID'");
}
else if($productType == "productName"){
	$query1 = mysql_query("select * from tbl_product where product_NAME = '$productID'");
}
else if($productType == "productType"){
	$query1 = mysql_query("select * from tbl_product where product_TYPE = '$productID'");
}
else{
	//$query1 = mysql_query("select * from tbl_product");
}
//$row = mysql_fetch_array($query1);
$i = 1;
echo "Y%";
while ($row=mysql_fetch_array($query1))
{
	if($i <= 20 && $i > 10){
			$allQuan = 0;
			$eachQuan = 0;
			$tempProd = $row['product_ID'];
			$result1 = mysql_query("Select * from tbl_introprod where product_ID = '$tempProd'");
			while ($row1=mysql_fetch_array($result1))
			{
				$eachQuan = $row1['product_QUANTITY'];
				$allQuan = $allQuan + $eachQuan;
			}
	if($allQuan != 0){
				echo "".$row['product_ID']."%".$row['product_NAME']."%".$row['product_TYPE']."%".$allQuan."%";
			}
	}
	$i = $i + 1;
}
echo " a";
//mysql_query("Insert into mydatabase.tbl_user values('$ID','$useremail','$password')");

 //echo "<script language='javascript'>alert(".$row['username'].")</script>";
?>