select * from shows where date >= '$year-$month-01' and date <=
'$year-$month-$lastdayofthemonth'

----- Original Message -----
From: "Matt Nigh" <[EMAIL PROTECTED]>
To: "php-db" <[EMAIL PROTECTED]>
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



-- 
PHP Database 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]

Reply via email to