MySQL Select Divide into columns of 3 or 4...

Ok so I’m trying to query a database, but instead of having my results just parsed onto the page, i’d like to have them organized into a table. I’ve done the best I can below to create an example:

RESULT 1 RESULT 2 RESULT 3 RESULT 4
RESULT 5 RESULT 6 RESULT 7 RESULT 8

Rather than:
RESULT 1
RESULT 2
RESULT 3
RESULT 4
RESULT 5
RESULT 6
RESULT 7
RESULT 8

I’ve used Smarty Templates and i know they have a similar feature that allows you to divide the SQL results by a number.

I’m looking to put each result inside of a

tag and create an organized category list.

Any suggestions?

Just do a normal loop and for every 3/x create a new row

This goes inside the loop
[php]if ($i % 3 === 0) {
// create new row
}[/php]

Thank you!!!

Sponsor our Newsletter | Privacy Policy | Terms of Service