Re: select based on time/date

From: Date: Wed, 26 Sep 2001 13:48:01 +0000
Subject: Re: select based on time/date
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68853@lists.php.net to get a copy of this message
date_add(time_in,interval 1 hour) is the same as time_in + interval 1 hour as of MySQL 3.23 so unless you are using 3.22 you should get the same result (anything prior to 3.22 won't support date_add) Neither query is going to work, however, because time_in is a varchar rather than one of the date types. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com ----- Original Message ----- From: "Jason Dulberg" <jdulberg@nas.net> To: <dempsejn@georgetown.edu>; <php-general@lists.php.net> Sent: Tuesday, September 25, 2001 6:24 PM Subject: RE: [PHP] select based on time/date > I plugged your query in and it didn't result in an error - however, it came > up with no results even though there should be. > > This one should have come up but didn't: > INSERT INTO logged_in VALUES ( '5', 'b406e68a7cde49534a14f5fd8848006e', > 'September 24, 2001, 3:27 pm', ''); > -- the fields correspond to the table structure quoted below > > Thanks again! > __________________ > Jason Dulberg > Extreme MTB > http://extreme.nas.net > > > > -----Original Message----- > > From: Jack Dempsey [mailto:dempsejn@georgetown.edu] > > Sent: September 25, 2001 7:07 PM > > To: 'Jason Dulberg'; 'Sheridan Saint-Michel'; > > php-general@lists.php.net > > Subject: RE: [PHP] select based on time/date > > > > > > select * from logged_in where date_add(time_in,interval 1 hour) <= now() > > > > -jack > > > > -----Original Message----- > > From: Jason Dulberg [mailto:jdulberg@nas.net] > > Sent: Tuesday, September 25, 2001 6:08 PM > > To: Sheridan Saint-Michel; php-general@lists.php.net > > 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) > > ); > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#68853) next »