ok, i started with a javascript problem, its resolution creates a php issue for me
heres what i need to do
i have a database, table looks like this
+-----------------------+
| ID | RACE | CLASS |
+----+--------+---------+
| 1 | Elf | Hunter |
| 2 | Dwarf | Mage |
| 3 | Elf | Warrior |
| 4 | Human | Druid |
| 5 | Ogre | Mage |
| 6 | Dwarf | Druid |
| 7 | Elf | Druid |
| 8 | Human | Hunter |
| 9 | Human | Mage |
| 10 | Ogre | Druid |
| 11 | Dwarf | Hunter |
| 12 | Ogre | Hunter |
+-----------------------+
i need to pull all this data, and format it like so
/*************************************************
* this will actually fit into a javascript code *
* this is the formatting i need, notice the *
* comma (or lack of) after the () *
*************************************************/
class = new Array(
new Array( // Dwarves
new Array("Druid", "Druid"), // comma
new Array("Hunter", "Hunter"), // comma
new Array("Mage", "Mage") // no comma
),
// Duplicated to show the Option Value and the Option Choice
new Array( // Elves
new Array("Druid", "Druid"),
new Array("Hunter", "Hunter"),
new Array("Warrior", "Warrior")
),
new Array( // Humans
new Array("Druid", "Druid"),
new Array("Hunter", "Hunter"),
new Array("Mage", "Mage")
),
new Array( // Ogres
new Array("Druid", "Druid"),
new Array("Hunter", "Hunter"),
new Array("Mage", "Mage")
)
);
As you can see, I need to sort each array alphabetically, and each nested array should be alphabetical too
i dont need the comments, that is just to show you where the info was pulled from
im sure it involves nested while loops, but not sure how to get it formatted properly, and with comma's where necessary, and missing where not
its probably simpeler than i am thinking, but who knows, i like to make my life difficult
make sence?