Link to home
Start Free TrialLog in
Avatar of onetoomany
onetoomany

asked on

PHP MYSQL REPEATER WITH COUNTER

Hello, I need to arrange the results of a mysql query into divs which require 2 counters:

Assuming the results are 9 rows containing fields title, image content...

Select * FROM tblcontent ORDER BY Ordinal ASC...

While ($row =.....)
{


}...

I need a arrange the results into page and column divs as follows:

div=Page1
   div=column1... fields title, image content...
   div=column2... fields title, image content...
   div=column3... fields title, image content...
div=Page2
   div=column1... fields title, image content...
   div=column2... fields title, image content...
   div=column3... fields title, image content...
div=Page3
   div=column1... fields title, image content...
   div=column2... fields title, image content...
   div=column3... fields title, image content...

So basically counter 'column' runs 1-3 and loops back after 3, counter page increments after every counter column loop.

There will always be 1 page div and 1 column, but there maybe, 2 columns or in the case of 4 columns that would be 2 pages.

I'm new to php so appreciate as much detail as possible.
Thanks.
repeats after
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of onetoomany
onetoomany

ASKER

Thanks Hielo! Worked.

a couple of questions:

echo ("")

Has to be wrapped in parenthesis? Has to be in double quotes? Are there any other methods to write this?