I ran into arecent problem which I was wondering if anyone else had come across.
I have a package where I track the time an account was created and the time of last visit. These are stored in the same table, right after each other as date_created, and last_modified. Both are Mysql TIMESTAMP types.
Naturally I don't want to ever change date_created. However, when I run a query to UPDATE last_modified to NOW() I've found that it _also sets date_created to NOW()_!!!
So something like
"UPDATE account_table SET last_modified=NOW()" results in both timestamp fields being set to NOW().
I've found a workaround for this by retrieving the date_created and updating it in the same statment as the last_modified but it feels like a kludge.
I've seen this behavior on four different installations of mysql (different servers, different versions of PHP as well). Unfortunately I didn't collect the version info. I've checked a bit on the mysql.com site and elsewhere but have never found anything. Anyone else run into something like this?
Hmm, the latest version of mysql was just officially declared stable. I should probably try it on that.
I have a package where I track the time an account was created and the time of last visit. These are stored in the same table, right after each other as date_created, and last_modified. Both are Mysql TIMESTAMP types.
Naturally I don't want to ever change date_created. However, when I run a query to UPDATE last_modified to NOW() I've found that it _also sets date_created to NOW()_!!!
So something like
"UPDATE account_table SET last_modified=NOW()" results in both timestamp fields being set to NOW().
I've found a workaround for this by retrieving the date_created and updating it in the same statment as the last_modified but it feels like a kludge.
I've seen this behavior on four different installations of mysql (different servers, different versions of PHP as well). Unfortunately I didn't collect the version info. I've checked a bit on the mysql.com site and elsewhere but have never found anything. Anyone else run into something like this?
Hmm, the latest version of mysql was just officially declared stable. I should probably try it on that.