I want to filter out records in the database which are registered in a given year.
I have the following option menu and it works...
<select name = years>";
$value = 2000;
for ($i =0; $i <= 100; $i++){
$value = $value + 1;
if($i== $years){$sel = "Selected";}
if($i!= $years){$sel = "";}
echo "<option value='".$i."'$sel>$value</option>";
}
echo "</select><br>";
Assume that there is a submit button called FilterByMonth.
if(isset($FilterByMonth)){
$query = "select * from table where YEAR(Datum) = $years";
.....
}
I know that the variable $years returns 1, 2, 3, 4, ....
As a result I couldn't get the correct out put as YEAR(Datum) belongs to 2000, 2001, 2002, ...
Is there any hint???
Thank you
solomon