Jump to content

Mysql Trigger


ngreenwood6

Recommended Posts

I have a question. I do alot of mysql work on a daily basis and I have heard about triggers before but never really used them. So I decided today to teach myself about them and see if I could find a practical use of them. One thing I thought they could really be useful for is deleting information from the database and keeping a backup. For instance if there are 5 articles in a database and user decides he wants to delete the 5th article it could then run a trigger to backup the data that would allow him to restore it in case he removed it accidently. Now my idea was to create one table that could store all of the deleted items whether it be articles,users,pages, etc. In that table it would just store the table name, maybe primary keys and other pertinent information to restore the data. One thing I was thinking of was having one field in the backup database that would be something like "data" that would have all of the information for the item serialized or something similar. Anyone know if this is possible and maybe have a link to an article with an example I could build off of.

Link to comment
https://forums.phpfreaks.com/topic/243290-mysql-trigger/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.