Example of trigger on after delete with update query mysqlBy Hardik Savani | April 5, 2016 | | 809 Viewer | Category : PHP MySql SQL
Share this post:
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;
- Simple Highcharts Chart Example using PHP MySQL Database
- Jquery notification popup box example using toastr JS plugin with demo
- Crop, Resize, Frames etc on selected image in php using Aviary
- How to remove empty values from array in PHP?
- Laravel 5 - Paypal Payment Integration example using netshell/paypal package from scratch
- Angularjs Simple Datepicker directive example code with Demo
- How to send mail example in Laravel 5?
- Mysql procedure with pagination in laravel 5?