我想为单个商店值检索多个offer_title
,报价等,但只返回一个商品。数据库中的特定商店有多个商店优惠。怎么做?
这是我的代码:
<?php
$sql ="SELECT * , Offer_Master.Store_id
FROM Store_Master_Profile
INNER JOIN Offer_Master
ON Store_Master_Profile.Store_Name = Offer_Master.Store_id
AND Store_Master_Profile.tag like '%Electronics%'
LIMIT 0 , 300 ";
require_once('Config.php');
$r = mysqli_query($con,$sql);
$result = array();
while($row = mysqli_fetch_array($r)){
array_push($result,array(
'storephoto'=>$row['storephoto'],
'Store_Name'=>$row['Store_Name'],
'Store_email'=>$row['email'],
'City_id'=>$row['City_id'],
'Area_id'=>$row['Area_id'],
'Address'=>$row['Address'],
'Latitude'=>$row['Latitude'],
'Longitude'=>$row['Longitude'],
'mobile'=>$row['mobile'],
'Store_Feature'=>$row['Store_Feature'],
'tag'=>$row['tag'],
'storeimages'=>$row['storeimages'],
'workingdays'=>$row['workingdays'],
'fromtime'=>$row['fromtime'],
'totime'=>$row['totime'] ,
'Offer_Title'=>$row['Offer_Title'],
'MRP_Price'=>$row['MRP_Price'],
'Actual_Price'=>$row['Actual_Price'],
'Description'=>$row['Description'],
'Expiry_Date'=>$row['Expiry_Date']
)
);
}
echo json_encode(array('result'=>$result));
mysqli_close($con);