Hi all,
I have a sql query running in a php form. Right now the code listed below works,but I need to sort by both the month and the year, not just the month. I have tried replacing the month variable with year_month but that doesnt seem to work to well. Would just like the user to be able to select Jan. 2004 or Feb 2005 and show only the items for that year/month. All of the month's items are showing up in the code below regardless of year. Anyone have any idea how to get this switched to work with a year & month format? Thanks!
$query = "SELECT DATE_FORMAT(webcal_entry.cal_date, '%d %M %Y'),webcal_entry.cal_create_by,webcal_site_extras.cal_data,webcal_entry.cal_description, DATE_FORMAT(webcal_entry_repeats.cal_end, '%d %M %Y') FROM webcal_entry INNER JOIN webcal_site_extras ON webcal_site_extras.cal_id=webcal_entry.cal_id LEFT OUTER JOIN webcal_entry_repeats ON webcal_entry_repeats.cal_id=webcal_entry.cal_id WHERE MONTH(webcal_entry.cal_date) = '".$datefilter."'";
<form method="get" action=newtest3.php?filter=<?php echo $datefilter ?>>
<table border="0"__width="180" bgcolor="#FFFFFF">
<tr>
<td>
<SELECT NAME="datefilter">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<p>
<input type="Submit" name="submit" value="OK">
</p>
<td>
</tr>
</table>
</form>