vinpkl — 2011-10-18T08:12:10-04:00 — #1
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 <font color='"#FF0000"'>(this is category name)</font>
1) Nokia<font color='"#FF0000"'> (these below are sub categories)</font>
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";
while($leftrow = mysql_fetch_array($leftresult))
echo "<td>" . "<a class='leftnav' title='".$dname. "-". $cname. "' href='http://localhost/mobiles-".$leftrow['dealer_id'] . "-" .$leftrow['category_id'] ."-".$dname."-".$cname.".html". "'>» " .$leftrow['dealer_name']. "</a></td>";
what should i do
sam32 — 2011-10-18T08:33:06-04:00 — #2
How the list should be presented? Any specific criterion?
guido2004 — 2011-10-18T08:36:44-04:00 — #3
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.
vinpkl — 2011-10-18T08:41:48-04:00 — #4
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?
sam32 — 2011-10-18T08:43:00-04:00 — #5
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.
vinpkl — 2011-10-18T08:49:34-04:00 — #6
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
sam32 — 2011-10-18T08:50:20-04:00 — #7
Use the approach suggested by Guido then.
guido2004 — 2011-10-18T09:01:38-04:00 — #8
vinpkl — 2011-10-18T09:26:28-04:00 — #9