Re: mysql select where problem

From: Date: Mon, 27 Aug 2001 03:02:25 +0000
Subject: Re: mysql select where problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11845@lists.php.net to get a copy of this message
select * from shows where date >= '$year-$month-01' and date <= '$year-$month-$lastdayofthemonth' ----- Original Message ----- From: "Matt Nigh" <matt@mattnigh.com> To: "php-db" <php-db@lists.php.net> Sent: Monday, August 27, 2001 7:09 AM Subject: [PHP-DB] mysql select where problem hello again, i'm stuck with this mysql query and can't seem to get it right // start code $result = mysql_query("select * from shows WHERE date >= '" . $year . "-" . $month . "-" . ("00") ."' AND where date <= '" . $year . "-" . $month . "-" . ("31") ."'"); // end code and yes, $year and $month are both defined earlier in the code. essentially what i want to do is have the 'date' field be equal or greater than ****-**-00 (ex. 2001-08-00) and equal or less than ****-**-31 (ex. 2001-08-31). i need this so that it selects only the given records within that given month. if anyone can help or at least point me in the right direction, i'd really appreciate it. i've looked at the mysql docs and haven't found anything for what i'm looking for. thanks in advance, Matt

« previous php.db (#11845) next »