用于显示图像的循环条件

I want to display all seats of a airline. If the seat is taken the image will be a red circle if it is vacant it will be green. what is the shorter way of doing this?

Sample Code

$result = mysqli_query($conn,"select *  from flight_seat_status where flight_number = '$_SESSION[departure]'");
    while($row = mysqli_fetch_assoc($result)){
     if (seat['status'] == 'vacant'){ <img src = "green.png"...>}else { img src = "red.png"...>

another thing i want to do is put them in rows of 4 using a tables in html

You could use the PHP Ternary Operator to echo the image:

echo "<img src='" . ($seat['status'] == 'vacant') ? "green.png" : "red.png" . "'>"