1

I have 4 tables :

object:

object_id(p.k) | object_type
1              | post
2              | event 

Like:

like_id | uid | object_id | object_type 

post:

post_id | text | like_count 

event:

event_id | name | like_count

I want to create a trigger in phpmyadmin which will increase the like_count in post and event table whenever there is an entry in like table.
Whenever a user will like post or event it will get insert to like table.
So I want Triggers structure like, if there is insert for like table then it should first check if object_id=1 then it will update like_count of post table and if object_id=2 then it will update like_count of event table

4

0 回答 0