<?php 

require 'db.php';

$result = array();
$prod = $con->query("select * from product");
	while($row = $prod->fetch_assoc())
	{
	$result['id'] = $row['id'];
    $result['product_name'] = $row['pname'];
    $result['product_image'] = $row['pimg'];
    $a = explode('$;',$row['pgms']);
    //print_r($a[0]);
    $ab = explode('$;',$row['pprice']);
    $k=array();
    for($i=0;$i<count($a);$i++)
    {
        $k[$i] = array("product_type"=>$a[$i],"product_price"=>$ab[$i]);
    }
    $result['price'] = $k;
	$result['discount'] = $row['discount'];
    $result['stock'] = $row['stock'];
    $d[] = $result;
	}
	
echo json_encode($d);
?>