query($sql3);
$result_array=$result->fetchAll();
$result->closeCursor();
$res_array = array();
$res_id_array = array();
foreach( $result_array as $res_info ) {
$res_array[$res_info["RES_ID"]] = $res_info;
$res_id_array[] = $res_info["RES_ID"];
}
$sql4 = " SELECT * FROM base_resource_matrix WHERE RES_ID IN (".implode(",",$res_id_array).") AND cancel_flag = 0 ";
$result=$pdo->query($sql4);
$result_array=$result->fetchAll();
$result->closeCursor();
$bus_array = array();
$bus_max_line = array();
foreach( $result_array as $seat_info ) {
if( !isset($bus_max_line[$seat_info["RES_ID"]]) ) {
$bus_max_line[$seat_info["RES_ID"]] = 0;
}
if( !isset($bus_array[$seat_info["RES_ID"]]) ) {
$bus_array[$seat_info["RES_ID"]] = array();
}
if( !isset($bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]]) ) {
$bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]] = array();
}
$bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]][$seat_info["POS_X"]] = $seat_info;
$bus_max_line[$seat_info["RES_ID"]] = $bus_max_line[$seat_info["RES_ID"]] < $seat_info["POS_X"] ? $seat_info["POS_X"] : $bus_max_line[$seat_info["RES_ID"]];
}
foreach( $bus_array as $res_id => $bus_info ) {
$bus_info = $bus_array[$res_id];
echo "
RES_ID:{$res_id} => {$res_array[$res_id]["RES_NAME"]}
";
echo "
".$seat_info["POS_NAME"]." | "; } echo "