This code is supposed to return event listings based on multiple months selected from a dropdown menu named "month_filter[]"from a database. With (JAN,FEB,MAR and APR) being the selected months.
//Comments are not in the actual code.
What's wrong with the "SELECT,WHERE,IN "SQL syntax? I get the error:
MySQL error 1064: You have an error in your SQL syntax near 'JAN'.'FEB'.'MAR'.'APR'')' at line 3
Code: Select all
if($date_filter!=$ALL)
{
$count = count($date_filter);
echo"$count"; //Just to test: (Returns 4)
}
if( $count > 1 )
{
$month_filter = implode( "'.'", $month_filter);
$month_filter="'$month_filter'"; // This adds quotes at both ends
echo "$month_filter"; //Just to test:(Returns 'JAN'.'FEB'.'MAR'.'APR')
$query="SELECT eventnum, date_year, date_month, date_day
FROM eventpost WHERE date_year='$year_filter' AND date_month IN ('$month_filter')";
$result = mysql_query($query);
while ($row=mysql_fetch_array($result, MYSQL_ASSOC)) etc.....Whats wrong?
Thanks for any help.