Jump to content

Best way of saving a post data as history if its updated.


zid

Recommended Posts

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
Share on other sites

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