简体   繁体   中英

Query from query result in foreach

so i have this function

public function GetNearAirport($adr)
{


    $acftrange = $this->GetAcftAdr($adr);
    $too = array();
    foreach ($acftrange as $key) {

        $result = $this->GetNearRange($adr,$key->range);



    }

The $acftrange give me some rows, and i need to get a new result for each row of $acftrange. But i need all results in one array So I can insert into the html table. Sorry for my english. In foreach the $key->range is a condition for the query to be made.

I assume getNearRange() returns an array. Use array_merge to append $result to $too

foreach ($acftrange as $key) {
    $result = $this->GetNearRange($adr,$key->range);
    $too = array_merge($too, $result);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM