首頁 >後端開發 >php教程 >PHP 怎么轮循

PHP 怎么轮循

WBOY
WBOY原創
2016-06-13 10:06:55923瀏覽

PHP 如何轮循
我是想求能满足多少个订单?为什么我这样不行??

$order_id = mysql_query("select order_id from myr_order where '".strtotime('-'.$date.' day')."' while($t_id = mysql_fetch_array($order_id,MYSQL_ASSOC)){
$is_in =1;
$num = 0;
$que = mysql_query("select goods_sn,order_id from myr_order_goods where order_id = '".$t_id['order_id']."'");
while($gs = mysql_fetch_object($que)){
if(in_array($gs->goods_sn,$sn) && $is_in==1){
$is_in = 1;
}elseif(in_array($gs->goods_sn,$sn) && $is_in==0){
$is_in = 0;
break;
}
}
if($is_in == 1){
$num = $num + 1;
}elseif($is_in == 0){
continue;
}
}
  echo $num;

------解决方案--------------------

PHP code
$sql = "select order_id from myr_order where '".strtotime('-'.$date.' day')."' goods_sn,$sn) && $is_in){        $is_in = 1;    }elseif(in_array($gs->goods_sn,$sn) && !$is_in){        $is_in = 0;        break;    }    if($is_in){        $num = $num + 1;    }elseif(!$is_i){        continue;    }}  echo $num;<div class="clear">
                 
              
              
        
            </div>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn