ok so i have this events calendar script that is just what i wanted and now i'm trying to make it so that it will make a link for the days that an event is scheduled.
how exactly would i go about doing this? i know its just like 5 short lines of code but if someone would show me what to put in for the harder part.
i'm not very familiar working with dates =\
you can just use this query for guideline to my db tables and stuff
$sql=@mysql_query("SELECT id,dateon FROM events");
$eventdate=@mysql_fetch_array($sql);
and the link that i need would be something along lines of href=\"events/index.php?".$eventdate['id']."\">
hope i explained myself clearly
and here is the code for the calendar right now.
<?php
// get this month and this years as an int
$thismonth = ( int ) date( "m" );
$thisyear = date( "Y" );
// find out the number of days in the month
$numdaysinmonth = cal_days_in_month( CAL_GREGORIAN, $thismonth, $thisyear );
// create a calendar object
$jd = cal_to_jd( CAL_GREGORIAN, date( "m" ),date( 1 ), date( "Y" ) );
// get the start day as an int (0 = Sunday, 1 = Monday, etc)
$startday = jddayofweek( $jd , 0 );
// get the month as a name
$monthname = jdmonthname( $jd, 1 )
?>
<table class="calendar" valign="bottom">
<tr>
<td colspan="7"class="calendar"><div align="center"><strong><?= $monthname ?></strong></div></td>
</tr>
<tr>
<td class="calendar"><strong>S</strong></td>
<td class="calendar"><strong>M</strong></td>
<td class="calendar"><strong>T</strong></td>
<td class="calendar"><strong>W</strong></td>
<td class="calendar"><strong>T</strong></td>
<td class="calendar"><strong>F</strong></td>
<td class="calendar"><strong>S</strong></td>
</tr>
<tr>
<?php
// put render empty cells
$emptycells = 0;
for( $counter = 0; $counter < $startday; $counter ++ ) {
echo "\t\t<td class=\"calendar\">-</td>\n";
$emptycells ++;
}
// renders the days
$rowcounter = $emptycells;
$numinrow = 7;
for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) {
$rowcounter ++;
echo "\t\t<td class=\"calendar\">$counter</td>\n";
if( $rowcounter % $numinrow == 0 ) {
echo "\t</tr>\n";
if( $counter < $numdaysinmonth ) {
echo "\t<tr>\n";
}
$rowcounter = 0;
}
}
// clean up
$numcellsleft = $numinrow - $rowcounter;
if( $numcellsleft != $numinrow ) {
for( $counter = 0; $counter < $numcellsleft; $counter ++ ) {
echo "\t\t<td class=\"calendar\">-</td>\n";
$emptycells ++;
}
}
?>
</tr>
</table>