开发者

Want to show latest updated/modified records in a tables for an admin tool dashboard.. without storing modify dates..possible?

开发者 https://www.devze.com 2023-02-24 10:26 出处:网络
I thought maybe there is MySQL command to pull up the last X records that were most recently modified.I know I could just put an extra field in that stores whenever a record is updated.. but I am tryi

I thought maybe there is MySQL command to pull up the last X records that were most recently modified. I know I could just put an extra field in that stores whenever a record is updated.. but I am trying to avoid that route if possible.

Any pointers? I just want to create a dynamic dashboard that allows the clien开发者_StackOverflow中文版t to quickly work with the most recently worked on records..

Ex: "most recent users", "most recent projects", "most recent companies".. etc.


Rather than storing data in the database, you could easily use session or cookie storage.

Create a stack of most recent references with a fixed size and manipulate this when a record is worked on. Your dashboard can then use this stack to display the records.


Why are you trying to avoid storing it in the DB? too much extra data? or too much work? Did you know mysql can auto update the last-mod column?

ALTER TABLE mytable
ADD lastmodified TIMESTAMP 
    DEFAULT CURRENT_TIMESTAMP 
    ON UPDATE CURRENT_TIMESTAMP;
0

精彩评论

暂无评论...
验证码 换一张
取 消