$value){ $a.="'".$value['company_code']."',"; $a1.="'".$value['id']."',"; } $b=rtrim($a, ','); $b1=rtrim($a1, ','); // print_r($b); $time=date("Y-m-d"); $sql1="select * from ytiot_t_maintenance_plan where personnel in(".$b1.") and planned_date='".$time."'";//and compamy_code in(".$b.")" $res1=add66($sql1); // print_r($res1);exit(); $lx1=''; foreach ($res1 as $key=>$value){ $sql2="select * from ytiot_t_route2 where id=".$value['route']; $res2=add($sql2); // print_r($res2); $lx=$res2[0]['route']; $res1[$key]['route_name']=$res2[0]['route_name']; $lx1=explode(",",$lx); // print_r(count(explode(",",$lx))); for ($i=0; $i