im trying to set up a calendar using the code from the following site, however i have only got up to the code displayed below, which the site says it should show a calendar however im getting this error. I do however want to set up the whole calendar to use it with events and a flat-file database, so if anyone can maybe check out the site and tell me why it isnt working i'd appreciate it.

Btw its supposed to have the source code to download, but if you read the comments you will learn that its not there.

Parse error: syntax error, unexpected $end in /home2/lifeimpr/public_html/allegro/calendar/cal.php on line 58

The site: http://www.devarticles.com/c/a/PHP/A-Useful-Event-Calendar-Written-In-PHP/2/

<?php
// Get values from query string 
$day = $_GET["day"]; 
$month = $_GET["month"]; 
$year = $_GET["year"]; 
$sel = $_GET["sel"]; 
$what = $_GET["what"]; 

if($day == "") 
$day = date("j"); 

if($month == "") 
$month = date("m"); 

if($year == "") 
$year = date("Y"); 

$currentTimeStamp = strtotime("$year-$month-$day"); 
$monthName = date("F", $currentTimeStamp); 
$numDays = date("t", $currentTimeStamp); 
$counter = 0; 
$numEventsThisMonth = 0; 
$hasEvent = false; 
$todaysEvents = ""; 
?>

<table width='350' border='0' cellspacing='0' cellpadding='0'> 
<tr> 
<td class='head' width='50'>S</td> 
<td class='head' width='50'>M</td> 
<td class='head' width='50'>T</td> 
<td class='head' width='50'>W</td> 
<td class='head' width='50'>T</td> 
<td class='head' width='50'>F</td> 
<td class='head' width='50'>S</td> 
</tr> 

<?php 
$numDays = date("t", $currentTimeStamp); 

for($i = 1; $i < $numDays+1; $i++, $counter++) 
{ 
$timeStamp = strtotime("$year-$month-$i"); 

if($i == 1) 
{ 
// Workout when the first day of the month is 
$firstDay = date("w", $timeStamp); 

for($j = 0; $j < $firstDay; $j++, $counter++) 
echo "<td>&nbsp;</td>"; 
} 

if($counter % 7 == 0) 
echo "</tr><tr>"; 

echo "<td width='50'>$I</td>";
?>

nvm i figured it out heres the code for anyone who wants to have a simple calendar.

<?php 
// Get values from query string 
$day = $_GET["day"]; 
$month = $_GET["month"]; 
$year = $_GET["year"]; 
$sel = $_GET["sel"]; 
$what = $_GET["what"]; 

if($day == "") 
$day = date("j"); 

if($month == "") 
$month = date("m"); 

if($year == "") 
$year = date("Y"); 

$currentTimeStamp = strtotime("$year-$month-$day"); 
$monthName = date("F", $currentTimeStamp); 
$numDays = date("t", $currentTimeStamp); 
$counter = 0; 
$numEventsThisMonth = 0; 
$hasEvent = false; 
$todaysEvents = "";
?>

<table width='320' border='0' cellspacing='2' cellpadding='0'> 
<tr>
<td colspan="7" align="left" valign="bottom"><div class="event"></div></td>
</tr>
<tr>
<tr>
<td colspan="7" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="image" src="images/month-prev-2.png" width="30" height="33" onmouseover="this.src='images/month-prev-1.png'" onmouseout="this.src='images/month-prev-2.png'" onClick='goLastMonth(<?php echo $month . ", " . $year; ?>)' /><input type="image" src="images/month-next-2.png" width="30" height="33" onmouseover="this.src='images/month-next-1.png'" onmouseout="this.src='images/month-next-2.png'" onClick='goNextMonth(<?php echo $month . ", " . $year; ?>)' /></td>
<td><div class="month"><?php echo $monthName . "."; ?></div></td>
</tr>
</table></td>
</tr>

<?php
$numDays = date("t", $currentTimeStamp); 

for($i = 1; $i < $numDays+1; $i++, $counter++) 
{ 
$timeStamp = strtotime("$year-$month-$i"); 

if($i == 1) 
{ 
// Workout when the first day of the month is 
$firstDay = date("w", $timeStamp); 

for($j = 0; $j < $firstDay; $j++, $counter++) 
echo "<td height='20'>&nbsp;</td>"; 
} 

if($counter % 7 == 0) 
echo "</tr><tr>"; 

if($i == date("d") && $month == date("m") && $year == date("Y")) 
echo "<td height='20' align='center' valign='middle' bgcolor='##0084FF'><font color='#FFFFFF'>$i</font></td>"; 
else
echo "<td height='20' align='center' valign='middle' bgcolor='#999999'><strong>$i</strong></td>";

}

$monthName = date("F", $currentTimeStamp); 
?>

<script type="text/javascript">
function goLastMonth(month, year) 
{ 
// If the month is Januaru, decrement the year 
if(month == 1) 
{ 
--year; 
month = 13; 
} 

document.location.href = 'index.php?month='+(month-1)+'&year='+year; 
} 

function goNextMonth(month, year) 
{ 
// If the month is December, increment the year 
if(month == 12) 
{ 
++year; 
month = 0; 
} 

document.location.href = 'index.php?month='+(month+1)+'&year='+year; 
} 
</script>
</tr></table>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.