Okay so I have a table of rows.
let's call them A, B, C, D, E, F, G, H, I, J
Here's the order I need them in:
C, D, A, B, G, H, E, F, I, J
Is there any possible way to do this without adding in a "order" field into the table?
Theirs only 2 ways off the top of my head i can think of sorting these.
Is to be smart, and use MYSQL's built in ORDER BY function
Is to have php order the data, which will be much slower.
bah. i just got word from my boss that he said to go ahead and do an "order" field in the table of the DB.. sorry for posting this.. :/
Just remember ... anytime you can have MySQL do something that php doesnt have to do, its going to be much faster.
well this is just an idea and i dont no how much this will help you. Like 'Sayian' says if you try to sort it using PHP it will be slow compairing to order it using a 'order by' function.
so i would suguest, keep an extra field in the table so that will define the order of the data. EX:
alphabet dataOrder
A 3 B 4 C 1 D 2 E 7 F 8 G 5 H 6 I 9 J 10
So now when you fetching the data you can use the 'dataOrder' field with 'order by' function.
TIP: To do so you need to know the order when you insert the data into the table.
As i said this is just an idea. Hope this would help your problem.
Good luck
Regards, Niroshan