I am creating a scheduling program and have run into a conundrum.

The program allows the user to add rooms that can be assigned to staff. Each staff member has their availability set with a start and end time and a break time. (in a mySQL database in the TIME format 00:00:00).

I am trying to output a weekly calendar. I'm not sure how to actually display it. All rooms could be full, the person could have an appointment, or they have room. Either way, I want to display the times down the left side of a table and the days across. I would like to have an appointment that runs over a 15 minute block (times are available at 00min, 15min, 30min, and 45min past the hour) it becomes one cell.

If anyone has any suggestions that'd be great. Here is what i have already to determine the next and previous weeks, any tips would be much appreciated:
PHP Code:
//SETUP CALENDAR BASIC VARIABLES
$days = array("Sunday""Monday""Tuesday""Wednesday""Thursday""Friday""Saturday");
$months = array("""January""February""March""April""May""June""July""August""September""October""November""December");
// number of days in each month
$totalDays = array(0312831303130313130313031);

//get the current date from the url
$currYear $_GET['currYear'];
$currMonth $_GET['currMonth'];
$currDay $_GET['currDay'];

//if not set find year, month, date
if(!$currYear) { $currYear date("Y"); }
if(!
$currMonth) { $currMonth date("n"); }
if(!
$currDay) { $currDay date("j"); }
//leap year
if (date("L"mktime(0,0,0,$currMonth,1,$currYear)))
    {
    
$totalDays[2] = 29;    
    }
$firstDayOfMonth date("w"mktime(0,0,0,$currMonth,1,$currYear));

//HANDLE SELECTING PREVIOUS WEEK
//defaults for previous week
$prevDay $currDay-7;
$prevMonth $currMonth;
$prevyear $currYear;
//if negative number change month
if($prevDay 1){
    
$prevMonth $currMonth-1;
    
$prevYear $currYear;
    
// if January, decrement year and set month to December
    
if ($prevMonth 1) {
        
$prevMonth=12;
        
$prevYear--;
    }
    
$prevDay $totalDays[$prevMonth] + $prevDay;
}
//prevDay less than 1

//HANDLE SECLECTING NEXT WEEK
//defaults for next week
$nextDay $currDay+7;
$nextMonth $currMonth;
$nextYear $currYear;
//if negative number change month
if($nextDay $totalDays[$currMonth]){
    
$nextMonth $currMonth+1;
    
$nextYear $currYear;
    
// if December, increment year and set month to January
    
if ($nextMonth 12) {
        
$nextMonth=1;
        
$nextYear++;
    }
    
$nextDay=$nextDay $totalDays[$currMonth];
}
//nextDay too big 
and here is my current output code:
PHP Code:
    //the actual week displayed
    
echo("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#000000\"><tr><td>");
    echo(
"<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr bgcolor=\"#FFFFFF\">");
    echo(
"<td>Time</td><td>$days[0]</td><td>$days[1]</td><td>$days[2]</td><td>$days[3]</td>");
    echo(
"<td>$days[4]</td><td>$days[5]</td><td>$days[6]</td></tr>");
    echo(
"</table></td></tr></table>"); 
Thanks in advance.