Thanks to everyone for your help!!

I have plenty to try here, I'll let you know how I get on with it....

Regards
Paul

----- Original Message -----
From: "Jyrki Leppala" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "p.whiter" <[EMAIL PROTECTED]>
Sent: Thursday, October 18, 2001 6:21 PM
Subject: Re: [PHP-DB] newbie - problems with Select and timestamp(14)
calculation


: Hi,
:
: There seems to be several ways to compare time. This is what I use
: to log out visitors if they do nothing in 1000 seconds. This would be
: easier to do with sessions, but when I made the site my ISP did not
: have PHP 4.x available. logtime column type is DATETIME, and it
: stores the date as mm-dd-yyyy.  UNIX_TIMESTAMP is seconds
: from some date in 1970(?), but you have to be prepared for the
: overflow problem in 2037.
: I have no idea about the performance issues of this setup, but it
: works fine for me.
:
: Regards,
: Jyrki Leppala
:
: $sql = "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(logtime)) AS timediff
:             FROM yourtable WHERE sessionid='$sessionid' ";
: $result = mysql_query( $sql ) or die ( 'Ei voi lukea' );
: $row = mysql_fetch_array($result);
: if ($row[timediff]>1000) $userlevel=0; // or whatever you need to do here
: $sql = "UPDATE table SET logtime=SYSDATE(),
:            userlevel='$userlevel' WHERE sessionid='$sessionid' ";
: $result = mysql_query( $sql ) or die ( 'Ei voi päivittää' );
:
:
: On 18 Oct 01, at 16:11, p.whiter wrote:
:
: From:           "p.whiter" <[EMAIL PROTECTED]>
: To:             <[EMAIL PROTECTED]>
: Date sent:      Thu, 18 Oct 2001 16:11:23 +0100
: Subject:        Re: [PHP-DB] newbie - problems with Select and
timestamp(14) calculation
:
: > Thanks for the reply, but the Timestamp(14) column (log_time) in my DB
: > saves the time as '20011018134612' this is the same format as the
: > NOW()+0 I think?
: >
: > I have tried various methods to get this to work. I've gone through
: > the manual and various books I have here but am having no joy at all.
: >
: > I have spent far too much time on this, it really should be quite
: > straightforward to compare against a Timestamp column!! If anyone else
: > has any ideas......
: >
: > Thanks
: > Paul
: >
:


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to