Cascade Update value in other records
Posted: Thu Oct 07, 2004 4:36 pm
Hello,
I have the following problem and I hope someone can help me out ....
I am developing some kind of web content management interface using php and mysql and to do this I have a form that calls up the content of a database field (the page content) and allows you to update it ... It all works pretty well, however I bumped against some problem .. when you edit a page or add a page you can give it a menu position ... (my left menu is created dynamically and the links to the various main pages are sorted according to the value in the field menu_pos in the table tbl_content, which contains the site content) ... but what do I need to do to update the menu_pos of the other pages?
...
say I have five pages (homepage, about, services, links & contacts) with each a menu_pos from 0 to 4 in the same order as the pages .. and now I edit the page 'Services' and decide to 'promote' it to menu_pos 1 .... therefor the code will have to update the record for page 'About' and change its menu_pos value to 2 (else I have 2 records with menu_pos = 1) .. how do I do that??
Any ideas, pseudo-code , real code would be greatly appreciated.
Thanks,
kind regards,
Leroyb
I have the following problem and I hope someone can help me out ....
I am developing some kind of web content management interface using php and mysql and to do this I have a form that calls up the content of a database field (the page content) and allows you to update it ... It all works pretty well, however I bumped against some problem .. when you edit a page or add a page you can give it a menu position ... (my left menu is created dynamically and the links to the various main pages are sorted according to the value in the field menu_pos in the table tbl_content, which contains the site content) ... but what do I need to do to update the menu_pos of the other pages?
say I have five pages (homepage, about, services, links & contacts) with each a menu_pos from 0 to 4 in the same order as the pages .. and now I edit the page 'Services' and decide to 'promote' it to menu_pos 1 .... therefor the code will have to update the record for page 'About' and change its menu_pos value to 2 (else I have 2 records with menu_pos = 1) .. how do I do that??
Any ideas, pseudo-code , real code would be greatly appreciated.
Thanks,
kind regards,
Leroyb