I shall do my best to copy enough code here to hopefully get my point across and see if anyone has any ideas on how to rememdy my situation. Thanks in advance for any and all help!
First I query my database, which is a single table and all info for each course is it's own row in the database using a primary key so courses from semester to semester with the same course number do not get confused.
The "term" will be built into the link one would click on from one of our other pages or if they will use a drop down to choose another semester. Then I query based on what "term" they want to view. I need to show from 8AM until about 10PM each day (but left out a lot of the later times for ease of reading).
Code: Select all
<?php
$requestedTerm = $_GET['term'];
$query = "SELECT ccID, ccBuilding, ccRoom, ccDepartment, ccCoursenumber, ccSection, cc0800, cc0830, cc0900, cc0930, cc1000, ccMonday, ccTuesday, ccWednesday, ccThursday, ccFriday, ccSaturday, ccSunday, ccTerm, ccStartdate, ccEnddate FROM cc_courses WHERE ccTerm= '$requestedTerm' ORDER BY ccID ASC";
$query_id = mysql_query("$query") or die(mysql_error());
while ($row = mysql_fetch_row($query_id)) {
$ccID = $row[0];
$ccBuilding = $row[1];
$ccRoom = $row[2];
$ccDepartment = $row[3];
$ccCoursenumber = $row[4];
$ccSection = $row[5];
$cc0800 = $row[6];
$cc0830 = $row[7];
$cc0900 = $row[7];
$cc0930 = $row[7];
$cc01000 = $row[7];
$ccMonday = $row[34];
$ccTuesday = $row[35];
$ccWednesday = $row[36];
$ccThursday = $row[37];
$ccFriday = $row[38];
$ccSaturday = $row[39];
$ccSunday = $row[40];
$ccTerm = $row[41];
$ccStartdate = $row[42];
$ccEnddate = $row[43];
$ccTime = $row[44];
}
Code: Select all
?>
<table>
<tr></tr>
<tr>
<td class="prev" colspan="4"><?php echo $previous_link; ?></td>
<td class="month" colspan="3"><?php echo $month_name . " " . $year; ?></td>
<td class="next" colspan="4"><?php echo $next_link; ?></td>
</tr>
<tr>
<th></th> <th></th>
<th>8:00</th> <th>8:30</th> <th>9:00</th> <th>9:30</th> <th>10:00</th>
</tr>
<?php
Code: Select all
foreach($days AS $day) {
?>
<tr>
<?php
foreach($day AS $dates) {
$date_to_match = date("m-d-Y", mktime(0,0,0,$month,$d,$year));
?>
<td><?php echo ($dayname); ?></td>
<td><?php echo ($dates); ?></td>
<td>
<?php
if ($cc0800 == "1") {
echo ($ccDepartment . "." . $ccCoursenumber);
} else {
echo " no ";
} ?></td><td><?php
if ($cc0830 == "1") {
echo ($ccDepartment . "." . $ccCoursenumber);
} else {
echo " no ";
} ?></td><td><?php
if ($cc0900 == "1") {
echo ($ccDepartment . "." . $ccCoursenumber);
} else {
echo " no ";
} ?></td><td><?php
if ($cc0930 == "1") {
echo ($ccDepartment . "." . $ccCoursenumber);
} else {
echo " no ";
} ?></td><td><?php
if ($cc1000 == "1") {
echo ($ccDepartment . "." . $ccCoursenumber);
} else {
echo " no ";
} ?></td><td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</form>
<?php mysql_close(); ?>
http://web1.johnshopkins.edu/classrooms ... Result.jpg
Thanks again for reading this far and for any help or suggestions you may have!