rbragg Posted May 23, 2007 Share Posted May 23, 2007 This question will probably sound really stupid: I am storing the date and time of an insertion into the db using now(). However, if I update any other fields/columns in the db later - that date/time is also updated. How can I prevent this? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/ Share on other sites More sharing options...
trq Posted May 23, 2007 Share Posted May 23, 2007 Can we see your update statement? It should be a simple matter of not updating that field. Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259948 Share on other sites More sharing options...
rbragg Posted May 23, 2007 Author Share Posted May 23, 2007 I'm not dabbling with the time at all: <?php $queryUpdate = " UPDATE vigil_call SET status = '$status' WHERE callID = '$callID' "; $update = mysql_query($queryUpdate); ?> I imagine my problem is that the column need not be the timestamp type? Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259952 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 $time=time(); then whenever you need a static time... use $time, instead of time()/now() Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259954 Share on other sites More sharing options...
Barand Posted May 23, 2007 Share Posted May 23, 2007 Sounds like the column is type TIMESTAMP, the purpose of which is to auto-update when the record is changed. Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259956 Share on other sites More sharing options...
taith Posted May 23, 2007 Share Posted May 23, 2007 oh... then no... no way of changing that... that i know of Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259964 Share on other sites More sharing options...
rbragg Posted May 23, 2007 Author Share Posted May 23, 2007 I imagine my problem is that the column need not be the timestamp type? Sounds like the column is type TIMESTAMP, the purpose of which is to auto-update when the record is changed. We were right. Changing the type gave the result I needed. Thanks everyone for your help. Link to comment https://forums.phpfreaks.com/topic/52658-prevent-time-from-updating/#findComment-259966 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.