Well, I've tried, and to a point succeeded, but there are too many unknowns involved with what I'm trying to do, i.e. too many things I have to take into consideration, and too many possible ways to do it.
My first idea, and one that I sort of got to work is to query the database at the top of the showMonth() function. The query would look for any records that has the same month and year as the $curMonth and $curYear variables, and if any exist, return the day. The day would be placed into an array. For example, if I had a records for Jan 15th, 22nd, and 30th in the database, and the current month I was creating a calendar for was Jan2003, then my array would look like:
$myArray[0] = 15;
$myArray[1] = 22;
$myArray[2] = 30;
Then, during the FOR loop where I am cycling through all of the days in the month and outputting the days to the table cell, I would run an IF statement that would check to see if the current day was a value inside $myArray. If so, I would create a link out of the date. The link would lead to a page (or function on the same page) that would show everything for that particular day.
I put all this into an array prior to the FOR loop because I don't want to have to query the database 28-31 times each time around.
I plan on making a basic version of the script here shortly, I can message you with a link when it's done if you like.