PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 12, 2022

[FIXED] How to get the edit history of a product on an e-commerce website?

 February 12, 2022     laravel, mysql, php     No comments   

Issue

I have built an e-commerce website where the admin can edit the products through MySQL. Now I want to display the edit history of each product. The edit history should contain the 'date when it was updated' and 'what was updated'.

This is my product table: Click here to see the table

I thought of creating new columns "Edit history" and "Edit Date" inside the product table. Whenever the admin would edit one column, it would get added here.

If anyone knows how to proceed with either this method or some alternative method to solve this issue, please let me know.


Solution

You could create a Trigger in SQL which would allow that if there is a modification you add automatically in your table the data. I let you look at this course if you want : Sql trigger or Sql Trigger. Then you add for the date a Now for the date of the update (the same day) and for the modifications in your trigger add some SQL to see the difference between the before and after. Also, as mentioned above, creating an Audit table would allow you to save your changes. Your triggers would make it easier to add rows. Good luck to you



Answered By - x300
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing