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.

The Database Forum


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



Reply
Get timestamp plus one month
Old 01-08-2010, 06:24 AM Get timestamp plus one month
Skilled Talker

Posts: 90
Trades: 0
Hi guys. Currently I have this code.

PHP Code:
$result mysql_query("SELECT TIME FROM $db_table WHERE ID='".$name."'");
    while(
$row mysql_fetch_array($result))
          { 
        if (
NOW() > $row['TIME'] + 1 month) {}
        else {}
                 } 
However this is not working. Basically I want to know weather the timestamp (TIME) stored on the database is more than a month old.
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2010, 06:41 AM Re: Get timestamp plus one month
Skilled Talker

Posts: 90
Trades: 0
OK now I have this which I think is close but still does not work correctly.

PHP Code:
$result mysql_query("SELECT TIME FROM $db_table WHERE ID='".$name."'");
    while(
$row mysql_fetch_array($result))
          { 
        if ( 
time() > $row['TIME'] + strtotime('+1 second')) {
            echo (
'old');
        } else { echo (
'newish');
        }} 
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
Old 01-08-2010, 08:43 AM Re: Get timestamp plus one month
Skilled Talker

Posts: 90
Trades: 0
SOLVED

PHP Code:
$result mysql_query("SELECT TIME FROM $db_table WHERE ID='".$name."'");
    while(
$row mysql_fetch_array($result))
          { 
        if (
$time $row['TIME'] < (24*60*60*30)) {
            
$update no
            echo (
'Too new to update');}
        } 
MUST BE UNIX TIME
__________________
Free Flash designs and tutorials at
Please login or register to view this content. Registration is FREE

Shorten your URL's with
Please login or register to view this content. Registration is FREE
xuroq is offline
Reply With Quote
View Public Profile
 
Old 01-08-2010, 09:18 AM Re: Get timestamp plus one month
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Use your db abilities...
If your TIME field is a timestamp, then:
PHP Code:
$result mysql_query("SELECT TIME FROM $db_table WHERE ID='$name' and TIME<now()-interval 1 hour"); 
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Get timestamp plus one month
 

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.81926 seconds with 12 queries