Jump to content

Doing something to every second result from query


garry

Recommended Posts

So what I want to have is a table with the latest reviews from my database and I want to have two results per row on the table. Here's the query I'm using:

 

SELECT reviews.id AS reviewid, reviews.artist_id, reviews.album_id, artists.id AS artistid,	artists.artist,
albums.id AS albumid, albums.title, albums.thumb
FROM artists, reviews, albums
WHERE reviews.artist_id = artists.id
AND reviews.album_id = albums.id
ORDER BY reviews.created_at DESC
LIMIT 5

 

And then I use a while loop to have a new <tr> for each result. How can I change this so I can have the first two results in a <tr> and the next two in another.. and so on..

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.