Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.