Welcome Guest, Not a member yet? Register   Sign In
Update Row Value If Another Row is Deleted
#2

After you delete a row, you can update the other rows where the rank is higher. You just need to know what rang was deleted. Something like this:

Code:
UPDATE SOMETABLE SET RANK = RANK + 1 WHERE RANK > ?

You can do this in your code, or with a database trigger, or if you use CI4, with a model event (before delete or after delete): https://codeigniter4.github.io/userguide...parameters
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: Update Row Value If Another Row is Deleted - by includebeer - 02-01-2020, 03:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB