What is wrong with this code?
<p>Why is it that when I view the month of November 2010 it also views the month of 2009? Can anyone help me?</p>

<pre><code>&lt;?php include("db.php");
$query = mysql_query("SELECT distinct YEAR(local_date) as year FROM tbl_localnews order by local_date desc");
while ($row = mysql_fetch_array($query)) {
    //$row = array_unique($r);
    $unique_year = $row['year'];
    echo($unique_year)."&lt;br&gt;";

    $query2 = mysql_query("select distinct monthname(local_date) as month from tbl_localnews where local_date like '$unique_year%' order by local_date desc");
    while ($r2 = mysql_fetch_array($query2)) {
        //$row2 = array_unique($r2);
        $unique_month = $r2['month'];
        print("&lt;a href='news.php?month=$unique_month'&amp;year=$unique_year&gt;News for $unique_month&lt;/a&gt;&lt;br&gt;");
        //echo($unique_month);
    }
}
?&gt;
</code></pre>

<p>This is my display</p>

<pre><code>&lt;?php
$year = $_REQUEST['year'];
$last_date = "";
$result = mysql_query("SELECT *,YEAR(local_date) as year FROM tbl_localnews where year(local_date)='".$year."' ORDER BY local_date DESC ");
//echo '&lt;h1&gt;'.$month.'&lt;/h1&gt;';
if (mysql_num_rows($result)) {
    while ($row = mysql_fetch_array($result)) {
        if ($row['local_date'] != $last_date) {
            print("&lt;h2&gt;News for ".date('F j, Y', strtotime($row['local_date']))."&lt;/h2&gt;");
            $last_date = $row['local_date'];
        }
        print("&lt;p&gt;&lt;b&gt;".$row['local_title']."&lt;/b&gt;&lt;/p&gt;");
        print("&lt;p&gt;".$row['local_desc']."&lt;/p&gt;");
        // print("&lt;p&gt;&lt;b&gt;".date('F j, Y',strtotime($row['local_date']))."&lt;/b&gt;&lt;/p&gt;");
        //print("&lt;p&gt;&lt;b&gt;".$row['local_title']."&lt;/b&gt;&lt;/p&gt;");
        //print("&lt;p&gt;".$row['local_desc']."&lt;/p&gt;");
    }
    mysql_free_result($result);
}
?&gt;
</code></pre>
