Link to home
Start Free TrialLog in
Avatar of maccaj51
maccaj51Flag for Afghanistan

asked on

php mysql creating a list and sorted

Hi Experts,

This is going to take some explaining...

I have a mysql table that simplistically looks like this:

                 Section      Category     Section_order    Category_Order
   
entry 1       A                 A                      1
entry 2       B                 B                        2              
entry 3      B                  X                                                     1
entry 4       A                X                                                      1
entry 5       B                Y                                                     2
entry 6       A                 Y                                                   2

I want to end up with tables... firstly sorted into sections in section_order... Then within those sorted in category order... like so:

Table 1
Entry 1
Entry 4
Entry 6

Table 2
Entry 2
Entry 3
Entry 5


Could you help me deliver a clean php code... the only way I can work it involves too many lines of php...

Many Thanks in advance
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Looks like your query would say something like ORDER BY Section, right?
Avatar of maccaj51

ASKER

Yeah but how would you then split it into tables and order them bu category order?

Am i going to have to just do multiple queries?
Sorry order the tables by section order

and order the contents of the tables by category ordeR?
ASKER CERTIFIED SOLUTION
Avatar of rubene
rubene
Flag of Netherlands 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
Didnt know you could do that... Ive worked a way round it!