[eluser]Unknown[/eluser]
I have a tricky issue to solve, let me see if you can help me...
Im developing a services directory using CodeIgniter + MySQL and, due to my client's business rules, theres 3 plan types. (Platinum, Gold and Silver - in this order from best to worse)
There is a table with the companies tha advertise in the directory, and each one of them may be paying one of this 3 plans.
The problem is:
I have to present the results following this rules:
1. Platinum comes first, than gold, than silver
2. Each range of results MUST BE random itself
Code:
Platinum 2
Platinum 1
Platinum 3
Gold 3
Gold 1
GOld 2
Silver 2
Silver 3
Silver 1
refresh and i get:
Code:
Platinum 1
Platinum 3
Platinum 2
Gold 2
Gold 1
GOld 3
Silver 2
Silver 1
Silver 3
Until now, so far so good. The problem is, with so many results, i have to paginate them
How can i do this keeping in mind that:
- The plan priority must be the same through the pages
- the results must be random within the plan "blocks"
- BUT the pagination CANT repeat records through pages or omiss some results
i have to achieve something like this (e.g. with a 4 per page pagination)
Code:
Page I:
Platinum 1
Platinum 4
Platinum 5
Platinum 3
Page II:
Platinum 2
Gold 5
Gold 3
Gold 1
Page III:
Gold 4
Gold 2
Silver 2
Silver 5
Page IV:
Silver 1
Silver 3
Silver 4
and refreshing, randomly changing the position of records INSIDE THE PLAN BLOCKS, within the pages, without repeat or omiss results in the 4 pages, in this example.
Somebody can help me, please. Its a challenge one
Thanks, Adriano.