<?php ob_start();
 session_start();
include($_SERVER['DOCUMENT_ROOT'].'/includes/connection.php');
//mysql_query("delete from moon_calendar");

$year=$_REQUEST['year'];

for($month=1;$month<=12;$month++)
{
$month3=strtolower(date("F",strtotime($year."-".$month."-01"))); 
$monthname=strtoupper(date("F",strtotime($year."-".$month."-01")));

?>
<h2 style="text-align:center; color:#CC9900;"><a name='<?php echo  $month3?>' id='<?php echo  $month3?>' style="color: #CC9900;"><?php echo $monthname."&nbsp;".$year?></a></h2> 
	   
   <div class="rTable"> 
		    <div class="rTableRow">
				<div class="rTableCell"  style="text-align:center; font-size:large;color:#e9c27b; ">Moon phase</div>
	        <div class="rTableCell"  style="text-align:center; font-size:large;color:#e9c27b; ">Date</div>
	        <div class="rTableCell"  style="text-align:center; font-size:large;color:#e9c27b; ">Time</div>
				</div>
		 <?php

$catquery=mysql_query("select * from moonphases where year(moondate)=".$year." and month(moondate)=".$month."  order by moondate asc");
  
 	while($noticia = mysql_fetch_array($catquery))
 	{ 
		 
	 $moonyear=date('Y',strtotime($noticia['moondate']));
	 $moonmonth=date('F',strtotime($noticia['moondate']));
	 $moonday=date('j',strtotime($noticia['moondate'])); 
	  
	?> 
	 				
				 <div class="rTableRow">
	        <div class="rTableCell"  style="text-align:center;  "><b><?php echo $noticia['moonphase']?></b></div>
	        <div class="rTableCell"  style="text-align:center;  "><b><?php echo $moonmonth."&nbsp;".$moonday.",&nbsp;".$moonyear?></b></div>
	        <div class="rTableCell"  style="text-align:center;  "><b><?php echo $noticia['phasetime']?></b></div>
          </div>
	        <?php 
						  }
		 					 
		 ?>
		 		 
		  </div>  
               	<br> <div style="float:right; font-size:large; color:#CC9900;"> <a href="#top"><b style="color:#CC9900;"><u>Top</u></b></a></div><br>  

		<?php
		 }
		 
 mysql_close($link);
?>  