I have (3) title categories in a main menu
each title has (3) sub categories
They are listed with category ids and with a sort order number
TABLE COLUMNS and ROWS
cat_id, parent_id, cat_name, sort_order
1 - 0 - CategoryA 1........1
2 - 0 - CategoryB 2........5
3 - 0 - CategoryC 3........9
4 - 1 - Sub CategoryA 1........2
5 - 1 - Sub CategoryA 2........3
6 - 1 - Sub CategoryA 3........4
7 - 2 - Sub CategoryB 1........6
8 - 2 - Sub CategoryB 2........7
9 - 2 - Sub CategoryB 3........8
10 - 3 - Sub CategoryC 1........10
11 - 3 - Sub CategoryC 2........11
12 - 3 - Sub CategoryC 3........12
Is there a php code to switch the sort order
for example the Main Categories
Like if I have an arrow link (an up and a down) on that (Main Category) row presented on my page from a php query results of that menu list
switch category 1 down one place and therefore move Category up 1 place along with there respective sub categories noted by the parent_d of the category_id
eg.
TABLE COLUMNS and ROWS
cat_id, parent_id, cat_name, sort_order NEW sort_order
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 - 0 - CategoryA 1........1..................5
2 - 0 - CategoryB 2........5..................1
3 - 0 - CategoryC 3........9..................9
4 - 1 - Sub CategoryA 1........2..................6
5 - 1 - Sub CategoryA 2........3..................7
6 - 1 - Sub CategoryA 3........4..................8
7 - 2 - Sub CategoryB 1........6..................2
8 - 2 - Sub CategoryB 2........7..................3
9 - 2 - Sub CategoryB 3........8..................4
10 - 3 - Sub CategoryC 1........10..................10
11 - 3 - Sub CategoryC 2........11..................11
12 - 3 - Sub CategoryC 3........12..................12
I dont know really where to start?...all I know is that if I can switch sort_order ...the menu will change position on the web page.
This list is already presented as rows from a simple query from 1 'table_categories'