zid Posted May 3, 2014 Share Posted May 3, 2014 Hi, If I want to let users update a post (title or text), what would be the best approach if I want to preserve the original data as browsable history? Example: Original Post containing tables: post_id, post_title, post_text, post_author If a user want to Edit/Update this post: - the new input should replace the post_title and post_text (preserving the post_id since it got comments associated with it). - the old input should be posted as a new history post, with a new post_id, old post_text, old post_title and have a refferal to the original post_id. Is this a good approach or should I go for something else? Link to comment https://forums.phpfreaks.com/topic/288211-best-way-of-saving-a-post-data-as-history-if-its-updated/ Share on other sites More sharing options...
TrickyInt Posted May 3, 2014 Share Posted May 3, 2014 Your example would be pretty bad, if you just have a while to go through all posts made, and show them on for example your frontpage - then it would both show the new and old version of the post. You could add a new table, for history posts, or you could add a new column in your existing table, called something like post_history, and then only, on your frontpage, show post where post_history == 0. Link to comment https://forums.phpfreaks.com/topic/288211-best-way-of-saving-a-post-data-as-history-if-its-updated/#findComment-1478033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.