Jump to content

updating timestamp without changing any other values.


seany123

Recommended Posts

im running this kinda query in php

 

mysql_query("UPDATE `user_log` SET `id`='$id' WHERE `user_id`='$user_id'");                                    

 

$id is exactly the same as the id in the query ALL im wanting it to do is just trigger then UPDATE so the timestamp on the row updates, but it doesnt work.

 

it DOES work if i change $id to something random, (which actually changes the values.)

 

any ideas?

 

i thought maybe i could update the timestamp value to the value of now() or something but i dont know if that would work.


CREATE TABLE IF NOT EXISTS `user_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `show` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `season_id` int(11) NOT NULL,
  `episode_id` int(11) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;

 

i have solved the problem by doing what i said and updating the date=now() but im still disappointed i had to do a "trick" to get this working.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.