I am trying to display the records that are returned from a query in a html table. So when the query is processed the 1st record in the mysql database table (containing the image and the song title) will be displayed in the first block in the html table (Row 1, Column1)
below and the 2nd record will be displayed in the second block of the table (Row 1, Column2)
and so on, but after three records have been displayed. I would want a new row in the table to be generated
HTML table output should look like this below:
column 1 column 2 column 3
-----------------------------------------
| Image1 | Image2 | Image3 |
row 1 -> | song title1 | song title2 | song title3 |
------------------------------------------
| Image 4 | Image 5 | Image6 |
row 2 -> | Song title4 | song title5 | song title6 |
------------------------------------------
And here is the structure of the table in my mysql database:
search
------------------------------
| Id | image | song |
------------------------------
row 1-> | 1 | image1 | song title1 |
------------------------------
row 2-> | 2 | image2 | song title2 |
------------------------------
row 3-> | 3 | image3 | song title3 |
------------------------------
row 4...
So far I can only display the results in a table but I don't know how to structure the table in the format of the html table example I gave above Here is the code I have so far:
while($row = mysql_fetch_assoc($queryset)) {
$id = $row['id'];
$image = $row['image'];
$song = $row['song'];
echo '<table style="width:100%">
<tr>
<td>
$image
<br>
$song
</td>
</tr>
</table>';
}
I apologies in advance if I have made any mistakes/errors or if I have wasted you time, I'm kind of new to this whole thing.?