This is my output code so far. It currently displays everything underneath each other, as expected.
<table id="dslrTable">
<?php
while($row = mysqli_fetch_assoc($result)) { ?>
<?php echo "<tr><td> <a href=model.php?id=" . $row["ID"] . ">" . "<img src=images/" . $row["Image URL"] . " </a></td></tr>"; ?>
<?php echo "<tr><td> <a href=model.php?id=" . $row["ID"] . ">" . $row["Make"] . " " . $row["Model"] . " </a></td><tr>"; ?>
<?php echo "<tr><td> <a href=#.php>[add to compare] </a> </td></tr>"; ?>
<?php } ?>
</table>
What I am trying to achieve is three tr's per row in the database. The image, make/model and then a hyperlink. After 4 "results", then make a new tr. Something like this.
<table>
<tr>
<td>Image 1</td>
<td>Image 2</td>
<td>Image 3</td>
<td>Image 4</td>
</tr>
<tr>
<td>Make and Model 1</td>
<td>Make and Model 2</td>
<td>Make and Model 3</td>
<td>Make and Model 4</td>
</tr>
<tr>
<td>Hyperlink 1</td>
<td>Hyperlink 2</td>
<td>Hyperlink 3</td>
<td>Hyperlink 4</td>
</tr>
<tr>
<td>Image 5</td>
<td>Image 6</td>
<td>Image 7</td>
<td>Image 8</td>
</tr>
<tr>
<td>Make and Model 5</td>
<td>Make and Model 6</td>
<td>Make and Model 7</td>
<td>Make and Model 8</td>
</tr>
<tr>
<td>Hyperlink 5</td>
<td>Hyperlink 6</td>
<td>Hyperlink 7</td>
<td>Hyperlink 8</td>
</tr>
</table>
And for this to keep going until my while loop stops. I know I need to use modulo division as well as a counter variable, but I can't get it to work.
Any help is appreciated, thanks.