Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
simple mysql notionw() func Question
Old 01-28-2004, 12:43 AM simple mysql notionw() func Question
Average Talker

Posts: 21
Location: San Antonio, TX
Trades: 0
HI, how do you prevent a date (timestamp) column from updating when doing an update to that row. Everytime I perform an update to a row the NOW() function causes it to update to the current time..I don't want that to happen. Can anyone help....I'm sure there is a really easy solution to this.

thanks,
Dave
section31 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-28-2004, 09:59 AM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Hey section,

Well you could do this:

When you initialy put the information in the database just put in a timestamp instead of using the NOW() function.

like so:
$today=getDate();
$today[0]; // Returns UNIX Timestamp

In your mysql database just put $today[0] instead of NOW(). that should do it. Atleast thast what I do and it works for me hehe
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 01-28-2004, 02:54 PM
Average Talker

Posts: 21
Location: San Antonio, TX
Trades: 0
What mysql datatype do u use. Would it work for me since i'm using the TIMESTAMP(14) datatype? This is not the same form as a unix timestamp...its in this form YYYYMMDDHHMMSS. Let me try and get back to you.

BTW, you don't need to do a getdate() if u just want a unix timestamp...just do a time(). Although the resources gained are neglible, its more efficient since thats all you want..

Last edited by section31; 01-28-2004 at 02:56 PM..
section31 is offline
Reply With Quote
View Public Profile
 
Old 01-28-2004, 03:17 PM
Average Talker

Posts: 21
Location: San Antonio, TX
Trades: 0
Nope i tried that, it didn't work. Does this mean I'm going to have to figure a way to format the date function using one of php functions in the exact format of the mysql timestamp...nooooooo...

I guess something like this will work right..

date("Ymdhis");

Last edited by section31; 01-28-2004 at 03:22 PM..
section31 is offline
Reply With Quote
View Public Profile
 
Old 01-28-2004, 03:25 PM
Average Talker

Posts: 21
Location: San Antonio, TX
Trades: 0
Well, i even tried that...and mysql still updates the d*** date field by itself....grrrrr...how the h*** do i fix this....i'm really p*****..hehe
section31 is offline
Reply With Quote
View Public Profile
 
Old 01-28-2004, 03:30 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
How do you have your tables setup?
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Old 01-28-2004, 04:02 PM
Average Talker

Posts: 21
Location: San Antonio, TX
Trades: 0
Well, i finally figured out a solution to this that never occured to me before...LOL

Why don't I just set the date equal to the previous value which works fine and as far as I know thats the only way to preven mysql from updating the date field.

Example, UPDATE table SET field1='field2' datefield=datefield;

horray.
section31 is offline
Reply With Quote
View Public Profile
 
Old 01-28-2004, 04:05 PM
ACJavascript's Avatar
Humble Mod

Posts: 548
Location: CT, USA
Trades: 0
Congrats!
__________________

Please login or register to view this content. Registration is FREE
- 100 Satisfied Customers - Custom Programming and Web Development
ACJavascript is offline
Reply With Quote
View Public Profile Visit ACJavascript's homepage!
 
Reply     « Reply to simple mysql notionw() func Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25961 seconds with 12 queries