Code: Select all
include 'calendarparent.php';
include 'config.php';
$today = date('j',$time);
$month = date('n');
$year = date('Y');
$events = mysql_query("SELECT *, DATE_FORMAT(date, '%M %e, %Y %h:%m:%s') as
date, DATE_FORMAT(date, '%c') as month, DATE_FORMAT(date, '%e') as day FROM calevents order by date desc") or die(mysql_error());
if($events)
{
$days = array();
while($row = mysql_fetch_array($events))
{
if($row['month'] == $month)
{
$day = $row['day'];
$days[$day] = array('events.php?action=view&id='.$row['id'], 'linked-day');
}
}
}
echo "<table style=\"margin: auto\"width=450>";
echo "<tr>";
for($month=1; $month<=12; $month++)
{
echo "<td style=\"vertical-align: top\">";
echo parent_calendar($year, $month, $days,2);
echo "<br /></td>";
if($month%3 == 0 and $month<12){
echo "</tr><tr>";
}
}
echo "</tr>";
echo "</table>";Code: Select all
echo parent_calendar($year, $month, $days,2);Which makes sense because $days is retrieved from the database if it is equal to the current month, but how can I change this so each date prints to the correct month and day?