Example of trigger on after delete with update query mysqlBy Hardik Savani | April 5, 2016 | | 2677 Viewer | Category : PHP MySql SQL
Sometimes we need to fire trigger like after delete update some fields of another tables. for example if you have chat_message tables and when remove row on this table then we need to update "remove_counter(remove_counter + 1)" on users table. i did give you bellow example you can see how to write trigger code:
CREATE TRIGGER add_ban_counter_in_users
AFTER DELETE ON `chat_messages`
FOR EACH ROW
SET remove_counter = users.remove_counter + 1
WHERE users.id = old.user_id;
- How to get last inserted id in laravel 5?
- Laravel 5.5 New Feature - BladeIf Directive Example
- Fadein Fadeout example in Jquery
- Jquery email autocomplete example with demo using jquery.email-autocomplete.min.js
- Codeigniter 3 - Basic CRUD application with MySQL Example with Demo
- How to convert object to array in Laravel 5?
- Laravel 5.3 - How to create SEO friendly sluggable URL