Re-ordering the sub categories

hi all

i am creating a navigation list(Categories + sub categories) in the left bar of my website.

Each Category has around 5-7 sub categories under them.


MOBILE PHONES [COLOR="#FF0000"](this is category name)[/COLOR]
1) Nokia[COLOR="#FF0000"] (these below are sub categories)[/COLOR]
2) Samsung
3) Sony
4) Motorola
5) Apple
6) Blackberry

at present they are displayed in a general loop acording to the number they were entered.

now i want to change the “display order” of sub categories.

means I want to move


"Sony" at No. 1
"Blackberry at No.2
"Samsung" at No. 3

at present this is my query


$leftqry="select * from dealer_table where category_id=1";
$leftresult=mysql_query($leftqry);
while($leftrow = mysql_fetch_array($leftresult))
{
echo "<tr>";
echo "<td>" . "<a class='leftnav' title='".$dname. "-". $cname. "' href='http://localhost/mobiles-".$leftrow['dealer_id'] . "-" .$leftrow['category_id'] ."-".$dname."-".$cname.".html". "'>&raquo; &nbsp;" .$leftrow['dealer_name']. "</a></td>";
echo "</tr>";
}				

what should i do

vineet

How the list should be presented? Any specific criterion?

Indeed. In order to order the data from the table in a specific order (doh) the table must have a column that contains the order criterium. So if you want to be able to change the order at will, you’ll need to have a ‘listorder’ column and add ’ ORDER BY listorder’ to your query.

hi guido

can me explain me a lit bit more about what kind of data should be entered in “listorder” column ?

shall i enter numeric data and then i will be updating this column to re-order my list?

vineet

There’s no need to add another column if he wants to order the list based, for instance, on a number of sales criterion. That’s why I asked.

hi sam

there is no reason for having particular creteria for presenting.

its just that i think “Sony” is first preference for my clients and then 2nd is “Blackberry”.

so i need to show “Sony” on No.1 and Blackberry at No. 2 and so on

vineet

vineet

vineet

Use the approach suggested by Guido then.

Yes.

thanks guido

vineet