[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Insert date into mysql table cell when any cell from same row has been edited

Posted on 2011-03-25
4
Medium Priority
?
551 Views
Last Modified: 2012-08-14
Hi,


I've got column in mysql table called 'date' and I want to have it automatically updated every time I edit any cell in specific row or in other words: every time when some cell has changed. Is there possible to do the following thing in mysql itself?
Example:
before changes:
1 12/01/2010 name surname address
after changes:
1 26/03/2011 sam surname address

In this case I changed 'name' to 'sam' and date has been changed automatically. I can do this in php, but if I can do this in mysql itself, it would save a lot of time, because I have quite many scripts for this table. I use php for editing mysql database.


Thanks for any help.


0
Comment
Question by:Zado
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
Binkers earned 2000 total points
ID: 35217775
You can use the timestamp data type to automatically keep track of this for you by using the following options when creating your column:
 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP

See the documentation for more info:  http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
0
 
LVL 8

Author Comment

by:Zado
ID: 35217844
Thanks, I'll check that later.
0
 
LVL 2

Expert Comment

by:ASta
ID: 35222558
trigger for update?
0
 
LVL 8

Author Closing Comment

by:Zado
ID: 35239798
Works perfectly, thanks.
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question