Hi, I'm having some trouble with the following and was wondering if anyone could offer assistance:
$query = "SELECT * FROM res WHERE YEAR(date) = '2000'";
if ($month != "00") {
$monthsql = " AND MONTH(date) = '$month'";
$query .= $monthsql;
}
$result = mysql_db_query($sqldb, $query);
I've got some <select> statements that allow the user to choose which month they want to look through, and if they choose "All" (which would basically be like looking through the year 2000 only) the value of $month is 00, otherwise its 01 for January, 02 for February, etc.
The problem I have is that the query isn't being performed at all, whereas if I just run the base query (SELECT * FROM res WHERE YEAR(date) = '2000') it runs fine. Any suggestions?