----- Original Message -----
From: "Jason Dulberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 2:35 PM
Subject: RE: [PHP] select based on time/date


> I had a look at the DATE_FORMAT info on the mysql doc page and its a bit
> easier to understand than the CONCATS.
>
> Would I want to use the CURTIME() function since I would want to select
> sessions based on the hour? How would I go about combining CURTIME with
the
> rest of my query?
>
> Theoretically, here is what I understand, please let me know whether or
not
> I am correct:
>
> select * from sessions where (CURTIME() - EXTRACT(MINUTE FROM $timein) >=
> 60);
> //where 60 is the lifespan of the session

The problem with this is curtime returns a number in HHMMSS format and your
extract
returns MM so you get HHMMSS - MM which is always going to be greater than
60
unless you are running your script in the first minute of the day (ie
000037 - 49).

Try this instead:

select * from sessions where $timein + interval 1 hour <= now();

> Thanks for your suggestions and time!
>
> __________________
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net

No Problem... hope that helps

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
PHP General 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