我在尝试提取分配给驱动程序的订单时遇到问题 - 我有一个foreach列出当天正在运行的所有驱动程序名称,然后在while循环中我获取驱动程序的已分配订单和列表他们在他们的盒子里,但它只取得了第一个司机而没有做其余的事。
我做错了什么?
<?
// pull drivers according to the time right now
$driverlist = current_working_employees('',$slot,'driver');
$dlist = explode(',',$driverlist);
$row_i=0;$o='';
foreach($dlist as $driver){
?>
<div class="col-sm-4"><b><? echo $driver; ?></b>
<div ui-jq="nestable" class="dd">
<ol class="dd-list">
<?
plugin();
$q = "
SELECT p.ID,
pm1.meta_value AS jckwds_timeslot,
pm2.meta_value AS jckwds_date
FROM posts p LEFT JOIN postmeta pm1
ON (
pm1.post_id=p.ID
AND
pm1.meta_key='jckwds_timeslot'
) LEFT JOIN postmeta pm2
ON (
pm2.post_id=p.ID
AND
pm2.meta_key='jckwds_date'
)
WHERE post_status='wc-processing' AND post_type='shop_order'";
$r = mysql_query($q) or die("QUERY ERROR: ".mysql_error());
while($rowa = mysql_fetch_assoc($r)){
$oid = $rowa['ID'];
if($rowa['jckwds_date'] == the_time_rightnow() && $rowa['jckwds_timeslot'] == $requested_time){
if( $driver == customer_detail($oid,'_wc_acof_4') ){
$o .= '<li class="dd-item dd3-item" data-id="'.$oid.'">';
$o .= '<div class="dd-handle dd3-handle">Drag</div>';
$o .= '<div class="dd3-content">';
$o .= '#'.$oid.' '.customer_detail($oid,'_billing_first_name').' '.customer_detail($oid,'_billing_last_name').'<br />';
$o .= customer_detail($oid,'_shipping_address_1').'<br />';
$o .= 'Assigned to: '.customer_detail($oid,'_wc_acof_4').'<br />';
$o .= ' </div></li>';
$row_i++;
}
}
}
echo ($row_i > 0) ? $o : '<li class="dd-item dd3-item" data-id="0"></li>';
?>
</ol>
</div>
</div>
<?
}
?>