I have a MySQL table with 6 records, each containing 5 fields.
ID - Name - Company - Spec - Status
1 Kerry Here 3 1
2 Jim There 2 1
3 Bob Over 6 99
4 Bill Under 4 3
5 You Up 1 1
6 Them Down 2 4
After retrieving those items, how can I store them in such a way that I can sort them by Name, or Spec, or Status, or Status then ID then Name etc?
I retrieved them so they were accessible using the following method...
$people[$num] = array("$id","$name","$company","$spec","$status");
Using array_multisort() I can sort each ARRAY (ie array_multisort($people[$num])) but that only sorts the single array so the output from $people[0] would look like this...
1 1 3 Here Kerry
...instead of the original order...
1 Kerry Here 3 1
What I need to do is keep the ARRAY order in tact, but change the order of the $people[] so I could sort by name, or company etc.
Also, the information stored in the $people[] was retrieved from several different MySQL tables, so it's not just as easy as doing a "SELECT * blah ORDER BY name" or whatever.
Any help would be greatly appreciated.
Cheers,
Kerry Emerson