sql结果进行循环
$data=$menu_list->query("select l.id,l.status,l.sort,l.page,l.list_id,l.name,l.plist,c.`name` as cnname,c.en_name as en_name from cms_menu_list l LEFT JOIN cms_seller_cate c on l.list_id=c.id where l.status=1 ".$where." order by l.sort asc ");
print_r($data);
$returnData=array();
$seller_cate=M('seller_cate');
$array=$seller_cate->find();
$mi=0;
for($i=0;$i<count($data);$i++)
{
$dishlist=$seller_list->where(" id in (".$data[$i]["plist"].") ".$where2." ")->select();
$mpage=split(",", $data[$i]["plist"]);
$mpage=count($mpage);
if($dishlist>0)
{
$returnData["Data"][$mi]["MenuId"]=$data[$i]["id"];
$returnData["Data"][$mi]["MenuName"]=$data[$i]["name"];
$returnData["Data"][$mi]["MenuStatus"]=$data[$i]["status"];
$returnData["Data"][$mi]["MenuSort"]=$data[$i]["sort"];
$returnData["Data"][$mi]["MenuPlist"]=$data[$i]["plist"];
$returnData["Data"][$mi]["MenuPage"]=$mpage;
$returnData["Data"][$mi]["ShopId"]=$data[$i]["page"];
$returnData["Data"][$mi]["ListId"]=$data[$i]["list_id"];
$returnData["Data"][$mi]["En_name"]=$data[$i]['en_name'];
$returnData["Data"][$mi]["Zhname"]=$data[$i]['cnname'];
for($j=0;$j<count($dishlist);$j++)
{
$returnData["Data"][$mi]["Detail"][$j]["id"]=$dishlist[$j]["id"];
$returnData["Data"][$mi]["Detail"][$j]["name"]=$dishlist[$j]["name"];
$returnData["Data"][$mi]["Detail"][$j]["en_name"]=$dishlist[$j]["en_name"];
$returnData["Data"][$mi]["Detail"][$j]["cate_id"]=$dishlist[$j]["cate_id"];
$returnData["Data"][$mi]["Detail"][$j]["sellercateId"]=$dishlist[$j]["sellercateId"];
$returnData["Data"][$mi]["Detail"][$j]["classification"]=$dishlist[$j]["classification"];
$returnData["Data"][$mi]["Detail"][$j]["site_logo"]=$dishlist[$j]["site_logo"]?$dishlist[$j]["site_logo"]:"";
$returnData["Data"][$mi]["Detail"][$j]["click_url"]=$dishlist[$j]["click_url"];
$returnData["Data"][$mi]["Detail"][$j]["recommend"]=$dishlist[$j]["recommend"];
$returnData["Data"][$mi]["Detail"][$j]["sort"]=$dishlist[$j]["sort"];
$returnData["Data"][$mi]["Detail"][$j]["description"]=$dishlist[$j]["description"];
$returnData["Data"][$mi]["Detail"][$j]["en_description"]=$dishlist[$j]["en_description"];
$returnData["Data"][$mi]["Detail"][$j]["freeshipment"]=$dishlist[$j]["freeshipment"];
$returnData["Data"][$mi]["Detail"][$j]["installment"]=$dishlist[$j]["installment"];
$returnData["Data"][$mi]["Detail"][$j]["has_invoice"]=$dishlist[$j]["has_invoice"];
$returnData["Data"][$mi]["Detail"][$j]["freeshipment"]=$dishlist[$j]["freeshipment"];
$returnData["Data"][$mi]["Detail"][$j]["cash_back_rate"]=$dishlist[$j]["cash_back_rate"];
$returnData["Data"][$mi]["Detail"][$j]["danwei"]=$dishlist[$j]["danwei"];
$returnData["Data"][$mi]["Detail"][$j]["en_danwei"]=$dishlist[$j]["en_danwei"];
}
$mi++;
}