ngreenwood6 Posted July 30, 2011 Share Posted July 30, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/243290-mysql-trigger/ Share on other sites More sharing options...
fenway Posted July 31, 2011 Share Posted July 31, 2011 It's easier to keep archived "versions" in equivalent table structures -- or even in the same table -- and triggers aren't ideal for that. Quote Link to comment https://forums.phpfreaks.com/topic/243290-mysql-trigger/#findComment-1249780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.