Forum Moderators: open
And I want to come out in this order:
Panasonic
Vizio
Samsung
Sony
RCA
How would I go about doing this? I have thought about assigning a number to each brand and have it come out in that order, but is there a better way for this?
Also make sure that you allow gaps in your current numbering to allow for additions in the future. (In other words, if you have
Panasonic, 1
Vizio, 2
Samsung, 3
Sony, 4
RCA, 5
You'll most likely have to do a lot of renumbering in the future if you want to add a new brand at the top spot.
SELECT * FROM `table` WHERE `id` IN ( $list_of_ids ) ORDER BY FIELD( id, $list_of_ids) ASC LIMIT 0,10
I find when you want to change the order they appear in later that it is easier to change the value of the "sort_order" field than it is to find all the queries that use the "ORDER BY FIELD" logic and then change those queries.
Both are fine solutions, in my eyes one is easier to maintain.