[Solved] Listing data from database in hierachy and returning it in that order to the database


NOTE : Since order is a reserved keyword you can use any other
name for the column

This can be achieved by taking order column in your table.

For Eg:

id  taskname    order
1   firsttask   1
2   firsttask   2
3   firsttask   4
4   firsttask   3
5   firsttask   5

Then while fetching get it order by asc for order column

SELECT * FROM tasks ORDER BY order ASC

Now you may allow the user to add the order in which the items look like by text box or dragable of jquery and then while storing in the database table you can store it via that order

solved Listing data from database in hierachy and returning it in that order to the database