RE: [PHP] select based on time/date

From: Date: Tue, 25 Sep 2001 19:35:12 +0000
Subject: RE: [PHP] select based on time/date
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68762@lists.php.net to get a copy of this message
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 Thanks for your suggestions and time! __________________ Jason Dulberg Extreme MTB http://extreme.nas.net > And, as someone recently pointed out in response to a similar suggestion > I made, there is a mysql DATE_FORMAT function that will do the same thing > without the CONCATS. > > > > -----Original Message----- > > From: Jason Dulberg [mailto:jdulberg@nas.net] > > Sent: martedì 25 settembre 2001 5.47 > > To: php-general@lists.php.net > > Subject: [PHP] select based on time/date > > > > > > I am using sessions on my site and have noticed that people often don't > > click the "logout" button -- something which I need them to do in order > > to clear their session from the db and update some site stats. In the > > sessions table, I have a field $timein (in format F j, Y, g:i a) that > > gets added when the user logs in and a $timeout field that gets added > > when they hit "logout". > > > > Basically, what I've been thinking of doing is using cron to run a php > > script every hour or so that will search the table for sessions with no > > $timeout field and $timein is more than X number of minutes old. > > > > My problem is that since I'm using the F j, Y, g:i a date/time format, > > how would I make the mysql select? Do I have to explode the $timein > > field? > > > > Any suggestions are appreciated. > > __________________ > > Jason Dulberg > > Extreme MTB > > http://extreme.nas.net >

« previous php.general (#68762) next »