Displaying results depending on its date (month & year)
<p>I have load of data in the DB and each row has a date column</p>

<p>Currently im pulling all the results onto a page but i want to split it up into months. 
I have buttons on my page that when clicked should display only the appropriate results, for example when the button January 2012 is click all the results for that month will be displayed</p>

<p>Heres an example of what im trying to achieve:
<a href="http://i.stack.imgur.com/PY7iN.jpg" rel="nofollow">http://i.stack.imgur.com/PY7iN.jpg</a></p>

<p>=================================================================================</p>

<pre><code>&lt;?php
$con = mysql_connect("localhost", "username", "pass");
if (!$con)
{
 die('Could not connect: ' . mysql_error());
}

mysql_select_db("database", $con);
$result = mysql_query("SELECT * FROM tablename"); 

$num_rows = mysql_num_rows($result);

echo "&lt;table border='0' cellspacing='0'&gt;";

while($row = mysql_fetch_array($result))
{
$i++;
if($i%2==0) $class="cell1"; else $class="cell2";
echo "&lt;tr class='$class'&gt;";
echo "&lt;td&gt;".$row["firstname"]." ".$row["lastname"]." thinks that it will happen on      
&lt;span class=datecolor&gt;".date('l jS F Y',strtotime($row['date']))."&lt;/span&gt;&lt;/td&gt;";
 echo "&lt;/tr&gt;";
 }  

  echo "&lt;/table&gt;";

  mysql_close($con);
  ?&gt; 
</code></pre>

<p>=========================================================================</p>

<p>Im looking for a little help on how i can display the results for each month by clicking on the buttons without it appearing all at the one time.</p>

<p>Also the when the page is first viewed id like it to automatically show the results for the current month, for example it if viewed now it would display the August results</p>

<p>Hope you can help</p>
