Time getting updated automatically when updating other field
Posted: Sun Jul 25, 2004 11:32 am
I have some fields in table tbl1. 2 of them are :
EntryTime: timestamp(14)
Viewed: integer
// mysql_query and all that........
$Viewed=$row['Viewed']+1;
When a person clicks on a particular item, the no: of views increases by one so I did : mysql_query("UPDATE tbl1 SET Viewed=$Viewed")
The EntryTime value exists when entering a new item and it automatically sets it to NOW().
Now, when I do this update for no: of views the EntryTime also gets updated to the current time (the time when the update takes place). I don't want that happening. I tried setting EntryTime to NULL and NOT NULL as default but still both ways a new entrytime gets updated when I'm updating some other field.
How do I rectify this ?
Thanks
EntryTime: timestamp(14)
Viewed: integer
// mysql_query and all that........
$Viewed=$row['Viewed']+1;
When a person clicks on a particular item, the no: of views increases by one so I did : mysql_query("UPDATE tbl1 SET Viewed=$Viewed")
The EntryTime value exists when entering a new item and it automatically sets it to NOW().
Now, when I do this update for no: of views the EntryTime also gets updated to the current time (the time when the update takes place). I don't want that happening. I tried setting EntryTime to NULL and NOT NULL as default but still both ways a new entrytime gets updated when I'm updating some other field.
How do I rectify this ?
Thanks