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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.