might be a tuffy :(
Posted 06 September 2006 - 02:12 AM
say you have 4 cats order by id ASC
how would i order then like this
anybody have any suggestions its done on almost all forum systems.
Posted 06 September 2006 - 02:40 AM
i want to order my categorys in a different way
my sql is like this mysql_query("SELECT * FROM table order by id DESC")
they come in order like this
but i want to rearange them in some sort of fasion so they order by some number
like say i had the rearanging script now all cat's would be ordered like this:
see what i mean i need to find a way on how to order the categories threw a form and update them is it possible to give alter tables and make a default number until its updated threw the form and order them that way?
say i alter the catgory table and make default 1 so all new cats will be 1 until thier updated then i want to order by that number. Very hard to explain since im not great with explaining nothen.
ALTER TABLE `categories` ADD `order` INT( 10 ) NOT NULL DEFAULT '1' AFTER `id` and all are 1 right now <didnt work
Posted 06 September 2006 - 03:44 AM
id order_by __________________ 1 3 2 6 3 1 4 5 5 2 6 4
Given th above example, the following query...
SELECT id FROM tbl ORDER BY order_by
id ___________________ 3 5 1 6 4 2
Does that help explain it?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users