I tried basically what you have but I got an error:

$sql="select * from logged_in where time_in + interval 1 hour <= now()";
$result = mysql_query($sql);

If it will help, here's the table structure -- looks like my structure is
bit different from what I orignally posted:

CREATE TABLE logged_in (
   id tinyint(4) DEFAULT '0' NOT NULL auto_increment,
   session varchar(100) DEFAULT '0' NOT NULL,
   time_in varchar(50) NOT NULL,
   KEY id (id)
);

Thanks again.

__________________
Jason Dulberg
Extreme MTB
http://extreme.nas.net


> 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();

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


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