<?php
include '../../db_connect.php';

if($_GET['mode']=='prodctval')
{

$sql = "SELECT `prodname`, `size`, `qnty`, `fresh`, `reprocess`, `demage`, `price`, `mrp` FROM `prodvar` WHERE prodname = '$_POST[prodcode]'";

 $emparray= array();
if($result = mysqli_query($con,$sql))
{
	while($row = mysqli_fetch_array($result))
	$emparray['productvar'][] = $row;
}
echo json_encode($emparray);

}
	
else{

$items = mysqli_query($con,"SELECT code, `gencode`, `color`, `stock`, `cat`, `sizesetcode`, `desc`, `unit`, `sets`,  `vat`, `ratiotot` FROM prodreg");

	while($row = mysqli_fetch_array($items)) 
	{
		
	 
	  echo $row['code']."|".$row['cat']."|".$row['color']."|".$row['desc']."|".$row['sizesetcode']."|".$row['sets']."|".$row['qty']."|".$row['fresh']."|".$row['reprocess']."|".$row['demage']."|".$row['ratiotot']."|".$row['gencode']."\n";
	
	
	}

}

mysqli_close($con);


?>
