You were right! I changed it to a timestamp (14) and the selection is
working great now.
Only problem is that when I logout which UPDATE's the table to clear the
$session field, the $time_in timestamp gets updated because of the NOW()
function. I need that date to stay the same when someone logs out.
$out = "UPDATE logged_in SET session='' WHERE (logged_in.userid='$aid') AND
Is there a way to only allow the NOW() to work when a row is added to the
table? Or perhaps another way....
Thank you again for your time. I've learned alot from this.
> -----Original Message-----
> From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]]
> Sent: September 26, 2001 9:38 AM
> To: Jason Dulberg; [EMAIL PROTECTED]
> Subject: Re: [PHP] select based on time/date
> The reason my query didn't work is you have time_in as a varchar.
> Change it to a datetime field or timestamp field and it should work.
> I would suggest making it a timestamp field. That way whenever
> you update the row (probably update the session field with a new
> session) MySQL will automatically set time_in to Now(). This will
> avoid a lot of headache for you =)
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> ----- Original Message -----
> From: "Jason Dulberg" <[EMAIL PROTECTED]>
> To: "Sheridan Saint-Michel" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, September 25, 2001 5:08 PM
> Subject: RE: [PHP] select based on time/date
> > 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
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]