一起使用Array和Foreach

I am looking for clarification on while loop and foreach loop...

say I have 2 tables both table have a field called MYID, MYID will be the same for both tables..

How would you accomplish echo certain fields once while another field multiple times.

example

while ($row = mysqli_fetch_assoc($result)) {

        $MYID = $row['MYID'];        
        $FullName = $row['FullName'];    
        $Photo = $row['Photo'];        


    // Display this info once     
    echo "<div>$FullName<br>Photo</div>";   


   // Array for table 2 row    
   $Images[] = array($row['Images']);

   foreach ($Images as $img){       
   //Display this row as many times as needed by data in this row.

       echo <div>$img</div>;
   }
}  

If you're using GROUP_CONCAT, $row['Images'] will be a comma-separated list, which you can split with explode().

while ($row = mysqli_fetch_assoc($result)) {

    $MYID = $row['MYID'];        
    $FullName = $row['FullName'];    
    $Photo = $row['Photo'];        
    // Display this info once     
    echo "<div>$FullName<br>Photo</div>";   

    // Array for table 2 row    
    $Images = explode(',', $row['Images']);
    foreach ($Images as $img){       
    //Display this row as many times as needed by data in this row.
       echo <div>$img</div>;
    }
}