Don't do it with PHP. Instead use the native functions of mySQL itself. Use the combination of CONCAT(), some string and date functions of mySQL. Something like CONCAT(SUBSTRING(), SUBSTRING(), ...) so you end up in the right time format i.e.: 0000-00-00. With that string you should be able to do time comparisons within mySQL database. In other words, go to mySQL documentation and read there. mySQL will do it way better and faster than PHP. Cheers, Maxim Maletsky PHPBeginner.com -----Original Message----- From: Jason Dulberg [mailto:[EMAIL PROTECTED]] Sent: marted́ 25 settembre 2001 5.47 To: [EMAIL PROTECTED] 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 -- 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] -- 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]
RE: [PHP] select based on time/date
Maxim Maletsky \(PHPBeginner.com\) Mon, 24 Sep 2001 20:40:43 -0700
- [PHP] select based on time/date Jason Dulberg
- Re: [PHP] select based on time/dat... Maxim Maletsky \(PHPBeginner.com\)
- Re: [PHP] select based on time/dat... David Robley
- RE: [PHP] select based on time/dat... Jason Dulberg
- Re: [PHP] select based on time/dat... Sheridan Saint-Michel
- RE: [PHP] select based on time/dat... Jason Dulberg
- RE: [PHP] select based on time/dat... Jack Dempsey
- RE: [PHP] select based on time/dat... Jason Dulberg
- Re: [PHP] select based on time... Sheridan Saint-Michel
- Re: [PHP] select based on time/dat... Sheridan Saint-Michel
- RE: [PHP] select based on time/dat... Jason Dulberg
- Re: [PHP] select based on time/dat... Sheridan Saint-Michel