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.

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.