query($sql); if( false == $result) { exit(); } $rowset=$result->fetchAll(); if( false == $rowset ) { exit(); } $result->closeCursor(); $order_id_array = array(); foreach( $rowset as $row_info ) { $order_id_array[] = $row_info["parent_order_id"]; } $update_sql = " UPDATE ORDER_MAIN SET OUTSIDE_SALE_ORG_ID=153 WHERE ORDER_ID IN(".implode(",",$order_id_array).") OR PARENT_ORDER_ID IN (".implode(",",$order_id_array).")"; $pdo2=conn1(); $pdo2->exec($update_sql);