Hello,
I am trying to format the results from my database query.
I have tried several things on my own and my logic just isn't working out. I currently retrieve data from a database and it returns the results in one long column. I would like to change it to where it returns the first 4 results in one row, then the next 4 in a new row and so on.
Ultimately, I would like it to return the first 20 results on the first page and then the next 20 results on the next page, etc...
Could anyone give me any advice that will point me in the right direction to get this accomplished?
Thanks!
Here is my current code that works perfectly, but it only returns one long column of results:
$rows = $db->getAll('SELECT upc, artist_name, album_title, image FROM lounge_products ORDER BY artist_name ASC, upc ASC');
foreach ($rows as $row) {
$artist_name = stripslashes($row[artist_name]);
$album_title = stripslashes($row[album_title]);
print "<tr><td rowspan=\"3\"><img src=\"../$row[image]\" width=\"60\" height=\"60\"></td>
<td colspan=\"2\">UPC: $row[upc]</td></tr>
<tr><td colspan=\"2\">Artist: $artist_name</td></tr>
<tr><td colspan=\"2\">Album: $album_title</td></tr>
<tr><tr><td></td><td><a href=\"WMRL_Del.php?upc=$row[upc]&artist_name=$row[artist_name]&album_title=$row[album_title]\">Delete</a>
<a href=\"WMRL_Update.php?upc=$row[upc]&artist_name=$row[artist_name]&album_title=$row[album_title]\">Update</a></td></tr>