![enter image description here](https://i.stack.imgur.com/XM0Y4.png)
I'm new here and need some help. I'm doing a web development course and have an assignment I need a hand with.

Basically, I want to send a query that picks 9 random records, and show the result as a 3x3 table.

Here's my code so far:

```
<div id="productgrid">
<?php
$query = mysqli_query($conn, "SELECT * FROM products
    ORDER BY RAND()
    LIMIT 9");
?>
<h2>Featured Products</h2>

<table>
    <?php
    while($products = mysqli_fetch_array($query)){
    $file = $products['prod_img'];
    $pid = $products['prod_id'];
    $product_price = $products['prod_price'];
    $image_id = $products['prod_id'];
    $desc = $products['prod_desc'];
    ?>
    <tr>
        <div class="bigred">
            <td class="bigred">
                <?php echo '<b>'. "$product_price".'</b>'; ?>
            </td>
        </div>
    </tr>
    <tr>
        <td>
            <img src="<?php echo $file ?>" height = "150px"     width="150px"/><br />
        </td>
        <div class="smallblack"
    </tr>
    <tr>
        <td class = "smallblack">
        <?php echo '<b>' . "$desc".'</b>'; ?>
        </td>
    </tr>
</div>
<?php } ?>

```

I can get it to generate the 9 random images but it puts them all directly under each other in one long column. Is there a way I can get them to display in 3 rows of 3?

I apologise if this is a dumb question, but I'm only starting out and appreciate the help.

Thank you :)

Pic attached as sample