SunQuest
           Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old December 1st, 2003, 07:11 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
stop timestamp updating

I have a database where a timestamp is recorded once an item is added, but when i edit, the timestamp auto updates. I don't want it to do this, I want the timestamp to stay as it was before i edited (so i effectively have recorded when it was first put into the database). Is there someway to do this? the only way i can think of is to call the timestamp, set it as a variable such as $timestamp and run the update sql string with the value inserted into the timestamp field $timestamp, is there a better way?

Reply With Quote
  #2  
Old December 1st, 2003, 08:33 AM
Seadoo Seadoo is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 133 Seadoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: stop timestamp updating

How is the time stamp auto updating itself? If it is using a trigger, then you must disable the trigger. If you do ityour way, I think it won't help.

Reply With Quote
  #3  
Old December 1st, 2003, 10:49 AM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: stop timestamp updating

I don't think there is a better way. The timestamp is designed to change to the current time on insert or update unless you specify a value for it, so that is what you would have to do, just like you described.

Reply With Quote
  #4  
Old December 1st, 2003, 11:07 AM
Danicek Danicek is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Czech Republic
Posts: 79 Danicek User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to Danicek
RE: stop timestamp updating

In this case I suggest not to use generic timestamp (I suppose you use it).
Just use datetime collumn and insert with getdate() (or similar function in you db) when you need to timestamp a row.

Reply With Quote
  #5  
Old December 1st, 2003, 10:46 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: stop timestamp updating

php Code:
Original - php Code
  1.  
  2. $query = "INSERT INTO table (datetime)
  3. VALUES (now())";
  4. mysql_query($query)


can i use the now() function to get to timestamp the datetime?

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > stop timestamp updating


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway