how to find the last dml action held on which row in a table using mysql

plz do me a favour ,

tanks in advance..

Look in the log file.

tanks fr ur reply bt i dn knw wr d log file located....

Look in the log file.

ya u r rite i dn knw hw to spell ...
1st u understood my question i dont need any log files i jst need to fetch last updated row in a table, any solution plz... to

And obviously you don't know how to spell, too. So look in the manual. If you don't know where that is located, use a search engine or read here: http://dev.mysql.com/doc/refman/5.0/en/log-file-maintenance.html

Well, if your tables don't have timestamp fields, looking in the log files is the only general solution I know of.
And just for curiosity's sake: is it especially cool to write as you do? Or are you trying to make it as hard as possible for others to understand your desires?

ya sorry man just for cool purpose only i reply like that and i found a solution for that the only way is to add one more column in table with default timestamp will solve this issue i think ....

this is my eg:
----------------
ALTER TABLE mytable
ADD lastmodified TIMESTAMP
DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP;

Then, to find out the last updated row,

SELECT * FROM mytable ORDER BY lastmodified DESC LIMIT 1;

if u found any option other than this means it will be usefull for me...

Well, if your tables don't have timestamp fields, looking in the log files is the only general solution I know of.
And just for curiosity's sake: is it especially cool to write as you do? Or are you trying to make it as hard as possible for others to understand your desires?

In my experience timestamp fields are not really useful because you can access your database not only through your application but also through maintenance tools (like mysql command line, phpMyAdmin etc.). If you alter values with those, also the timestamp will be altered. That may be suitable for your purposes, for mine it has been more often not. I rather have a datetime field which is updated by the application explicitly.

i dont understand will you please explain it briefly..

In my experience timestamp fields are not really useful because you can access your database not only through your application but also through maintenance tools (like mysql command line, phpMyAdmin etc.). If you alter values with those, also the timestamp will be altered. That may be suitable for your purposes, for mine it has been more often not. I rather have a datetime field which is updated by the application explicitly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.