I'm creating a CMS using PHP and as a begginer I ran into a simple problem. In the menu section, I use a table with this information: ID ORDER NAME
ORDER describes in what place will the menu element appear in the menu. While deleting a menu item, I want a script, that will automatically reduce the ORDER number by 1 for all the menu items, that have the order number greater than that deleted item. Could anyone write that for me? Thank you
Is this what you're looking for?
UPDATE table_name
SET order = order - 1
WHERE order > deleted_item_order_number
that should be simple, you should refer to some php-mysql tutorial to strengthen your skills, otherwise you will end up creating not a very good cms.
here is your query:
update TABLE set order = order-1 where item_id > [your_deleter_item_id]