Re: php/mySQL time comparison

From: Date: Fri, 14 Mar 2003 15:14:31 +0000
Subject: Re: php/mySQL time comparison
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139718@lists.php.net to get a copy of this message
Thanks people, thank you very very much. the missing quotes were the problem. Can't beleive I kept missing that, everytime I re-read the code. Sorted now, and I've still got some hair!! You people are legends!!! Cheers, Brad Nel vino la verità, nella birra la forza, nell'acqua i bacilli -------------------------------------------------------------------------- In wine there is truth, in beer there is strength, in water there are bacteria > From: Brad Wright <bradwright@optushome.com.au> > Date: Sat, 15 Mar 2003 00:33:15 +1000 > To: <php-general@lists.php.net> > Subject: [PHP] php/mySQL time comparison > > Hi all, > > I have been tearing my hair out for weeks with this problem, hope someone > can help. > > I want to pull all data out of a mysql table that falls between two dates (a > start-time and end-time). > > I use PHP to allow the user to specify the time interval, creating 2 > variables > 'startTime' and 'endTime'. These are formatted thus: 2002-02-25 00:00:00 > (YYYY-MM-DD HH:mm:ss). > > I then use the syntax: > $query = "select * from Job_TB where teamNo = $teamNo AND startTime >= > $timeFrom AND endTime <= $timeTo"; > $result = mysql_query($query,$db) or die ("somethings wrong"); > > to query the mysql DB. But it doesnt work. Is there a glaring error in my > syntax? > > Can anyone help with this as its driving me nuts > > Hope someone can help, thanks in advance, > brad > Cheers, > > Brad > > > Nel vino la verità, nella birra la forza, nell'acqua i bacilli > -------------------------------------------------------------------------- > In wine there is truth, in beer there is strength, in water there are > bacteria > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#139718) next »