Forum Moderators: coopster
Add
error_reporting(E_ALL); to the top of the page, or check your error logs to see if anything is happening. If something is, either fix it, or post the error here with its respective line in the code.
It is still cutting off the bottom of the page from being generated. Any thoughts? I would also post my php, but I guess we can't post a whole lot of code on here because it's telling me that my post is too large when I do so... dang.
<?php
include "convertTime.php";
$link = mysql_connect("localhost", "thomas", "Pele1!");
if(! $link)
die("Couldn't connect to DB: " .mysql_error());
$db = "calendar";
mysql_select_db($db) or die("Couldn't open DB: " .mysql_error());
$date = $_GET['date'];
$days[0] = "sunday";
$days[1] = "monday";
$days[2] = "tuesday";
$days[3] = "wednesday";
$days[4] = "thursday";
$days[5] = "friday";
$days[6] = "saturday";
$day = $_GET['day'];
$mon = $_GET['mon'];
$year = $_GET['year'];
/*if($date!= "")
{
echo "Times for $mon/$day/$year <br><br>";
}*/
//check to see if the date clicked was in the dates for intersessions,
//exceptions, and possibly in extended hours (for jerome)
$query = "select num from intersessionDates where '$date' between startDate and endDate";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$d = mysql_fetch_array($result);
$id = $d['num'];
if($id!= NULL)
{
PrintIntersession($id, $day);
return;
}
$query = "select num from exceptionDates where '$date' between startDate and endDate";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$d = mysql_fetch_array($result);
$id = $d['num'];
if($id!= NULL)
{
PrintException($id, $day);
return;
}
$query = "select num from extendedDates where '$date' between startDate and endDate";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$d = mysql_fetch_array($result);
$id = $d['num'];
if($id!= NULL)
{
PrintExtended($id, $day);
return;
}
$query = "select num from regularDates where '$date' between startDate and endDate";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
$d = mysql_fetch_array($result);
$id = $d['num'];
if($id!= NULL)
{
PrintGeneral($id, $day);
return;
}
function PrintIntersession($id, $day)
{
//array to days closed
$arr[0] = "suclose";
$arr[1] = "mclose";
$arr[2] = "tclose";
$arr[3] = "wclose";
$arr[4] = "thclose";
$arr[5] = "fclose";
$arr[6] = "saclose";
//days of the week opening time
$open[0] = "suO";
$open[1] = "monO";
$open[2] = "tuO";
$open[3] = "wedO";
$open[4] = "thO";
$open[5] = "fO";
$open[6] = "saO";
//days of the week closing time
$close[0] = "suC";
$close[1] = "monC";
$close[2] = "tuC";
$close[3] = "wedC";
$close[4] = "thC";
$close[5] = "fC";
$close[6] = "saC";
$library[0] = "jerome_intersession";
$library[1] = "browne_intersession";
$library[2] = "archive_intersession";
$library[3] = "curriculum_intersession";
$library[4] = "music_intersession";
$library[5] = "depository_intersession";
$library[6] = "ogg_intersession";
$library[7] = "refdesk_intersession";
$libCaps[0] = "Jerome Library";
$libCaps[1] = "Browne Popular Culture Library";
$libCaps[2] = "Center for Archival Collections & Historical Collections of the Great Lakes";
$libCaps[3] = "Curriculum Resource Center";
$libCaps[4] = "Music Library and Sound Recordings Archives";
$libCaps[5] = "Northwest Ohio Regional Book Depository (Perrysburg)";
$libCaps[6] = "Ogg Science Library";
$libCaps[7] = "Research/Info Desk - Main floor";
echo "INTERSESSION HOURS <br><br>";
for($y = 0; $y < 8; $y++)
{
$query = "select dateID, TIME_FORMAT(monO, '%h:%i %p') as monO, TIME_FORMAT(monC, '%h:%i %p') as monC, TIME_FORMAT(tuO, '%h:%i %p') as tuO, TIME_FORMAT(tuC, '%h:%i %p') as tuC, TIME_FORMAT(wedO, '%h:%i %p') as wedO, TIME_FORMAT(wedC, '%h:%i %p') as wedC, TIME_FORMAT(thO, '%h:%i %p') as thO, TIME_FORMAT(thC, '%h:%i %p') as thC, TIME_FORMAT(fO, '%h:%i %p') as fO, TIME_FORMAT(fC, '%h:%i %p') as fC, TIME_FORMAT(saO, '%h:%i %p') as saO, TIME_FORMAT(saC, '%h:%i %p') as saC, TIME_FORMAT(suO, '%h:%i %p') as suO, TIME_FORMAT(suC, '%h:%i %p') as suC, mclose, tclose, wclose, thclose, fclose, saclose, suclose from $library[$y] where dateID = '$id'";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
if($d[$arr[$day]] == "closed")
echo "$libCaps[$y] hours: CLOSED <br>";
else
{
echo "$libCaps[$y] hours: " . convert($d[$open[$day]]) . " - " . convert($d[$close[$day]]) . "<br>";
}
}
}
function PrintException($id, $day)
{
//array to days closed
$arr[0] = "suclose";
$arr[1] = "mclose";
$arr[2] = "tclose";
$arr[3] = "wclose";
$arr[4] = "thclose";
$arr[5] = "fclose";
$arr[6] = "saclose";
//days of the week opening time
$open[0] = "suO";
$open[1] = "monO";
$open[2] = "tuO";
$open[3] = "wedO";
$open[4] = "thO";
$open[5] = "fO";
$open[6] = "saO";
//days of the week closing time
$close[0] = "suC";
$close[1] = "monC";
$close[2] = "tuC";
$close[3] = "wedC";
$close[4] = "thC";
$close[5] = "fC";
$close[6] = "saC";
$temp[0] = "jerome_regular";
$temp[1] = "browne_regular";
$temp[2] = "archive_regular";
$temp[3] = "curriculum_regular";
$temp[4] = "music_regular";
$temp[5] = "depository_regular";
$temp[6] = "ogg_regular";
$temp[7] = "refdesk_regular";
$library[0] = "jerome_exception";
$library[1] = "browne_exception";
$library[2] = "archive_exception";
$library[3] = "curriculum_exception";
$library[4] = "music_exception";
$library[5] = "depository_exception";
$library[6] = "ogg_exception";
$library[7] = "refdesk_exception";
$libCaps[0] = "Jerome Library";
$libCaps[1] = "Browne Popular Culture Library";
$libCaps[2] = "Center for Archival Collections & Historical Collections of the Great Lakes";
$libCaps[3] = "Curriculum Resource Center";
$libCaps[4] = "Music Library and Sound Recordings Archives";
$libCaps[5] = "Northwest Ohio Regional Book Depository (Perrysburg)";
$libCaps[6] = "Ogg Science Library";
$libCaps[7] = "Research/Info Desk - Main floor";
$count = -1;
echo "EXCEPTION HOURS <br><br>";
for($y = 0; $y < 8; $y++)
{
$query = "select dateID, TIME_FORMAT(monO, '%h:%i %p') as monO, TIME_FORMAT(monC, '%h:%i %p') as monC, TIME_FORMAT(tuO, '%h:%i %p') as tuO, TIME_FORMAT(tuC, '%h:%i %p') as tuC, TIME_FORMAT(wedO, '%h:%i %p') as wedO, TIME_FORMAT(wedC, '%h:%i %p') as wedC, TIME_FORMAT(thO, '%h:%i %p') as thO, TIME_FORMAT(thC, '%h:%i %p') as thC, TIME_FORMAT(fO, '%h:%i %p') as fO, TIME_FORMAT(fC, '%h:%i %p') as fC, TIME_FORMAT(saO, '%h:%i %p') as saO, TIME_FORMAT(saC, '%h:%i %p') as saC, TIME_FORMAT(suO, '%h:%i %p') as suO, TIME_FORMAT(suC, '%h:%i %p') as suC, mclose, tclose, wclose, thclose, fclose, saclose, suclose from $library[$y] where dateID = '$id'";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
if($d[$arr[$day]] == "closed")
echo "$libCaps[$y] hours: CLOSED <br>";
if($d[$open[$day]] == "")
{
$count++;
$libs[$count] = $temp[$y];
}
else
{
echo "$libCaps[$y] hours: " . convert($d[$open[$day]]) . " - " . convert($d[$close[$day]]) . "<br>";
}
}
if($count > -1)
{
echo "<br>GENERAL HOURS FOR REST OF LIBRARIES<br><br>";
for($x = 0; $x <= $count; $x++)
{
printGen($libs[$x], $day);
}
}
}
function PrintExtended($id, $day)
{
//array to days closed
$arr[0] = "suclose";
$arr[1] = "mclose";
$arr[2] = "tclose";
$arr[3] = "wclose";
$arr[4] = "thclose";
$arr[5] = "fclose";
$arr[6] = "saclose";
//days of the week opening time
$open[0] = "suO";
$open[1] = "monO";
$open[2] = "tuO";
$open[3] = "wedO";
$open[4] = "thO";
$open[5] = "fO";
$open[6] = "saO";
//days of the week closing time
$close[0] = "suC";
$close[1] = "monC";
$close[2] = "tuC";
$close[3] = "wedC";
$close[4] = "thC";
$close[5] = "fC";
$close[6] = "saC";
$library[0] = "jerome_extended";
$library[1] = "browne_extended";
$library[2] = "archive_extended";
$library[3] = "curriculum_extended";
$library[4] = "music_extended";
$library[5] = "depository_extended";
$library[6] = "ogg_extended";
$library[7] = "refdesk_extended";
$temp[0] = "jerome_regular";
$temp[1] = "browne_regular";
$temp[2] = "archive_regular";
$temp[3] = "curriculum_regular";
$temp[4] = "music_regular";
$temp[5] = "depository_regular";
$temp[6] = "ogg_regular";
$temp[7] = "refdesk_regular";
$libCaps[0] = "Jerome Library";
$libCaps[1] = "Browne Popular Culture Library";
$libCaps[2] = "Center for Archival Collections & Historical Collections of the Great Lakes";
$libCaps[3] = "Curriculum Resource Center";
$libCaps[4] = "Music Library and Sound Recordings Archives";
$libCaps[5] = "Northwest Ohio Regional Book Depository (Perrysburg)";
$libCaps[6] = "Ogg Science Library";
$libCaps[7] = "Research/Info Desk - Main floor";
$count = -1;
echo "EXTENDED HOURS<br><br>";
for($y = 0; $y < 8; $y++)
{
$query = "select dateID, TIME_FORMAT(monO, '%h:%i %p') as monO, TIME_FORMAT(monC, '%h:%i %p') as monC, TIME_FORMAT(tuO, '%h:%i %p') as tuO, TIME_FORMAT(tuC, '%h:%i %p') as tuC, TIME_FORMAT(wedO, '%h:%i %p') as wedO, TIME_FORMAT(wedC, '%h:%i %p') as wedC, TIME_FORMAT(thO, '%h:%i %p') as thO, TIME_FORMAT(thC, '%h:%i %p') as thC, TIME_FORMAT(fO, '%h:%i %p') as fO, TIME_FORMAT(fC, '%h:%i %p') as fC, TIME_FORMAT(saO, '%h:%i %p') as saO, TIME_FORMAT(saC, '%h:%i %p') as saC, TIME_FORMAT(suO, '%h:%i %p') as suO, TIME_FORMAT(suC, '%h:%i %p') as suC, mclose, tclose, wclose, thclose, fclose, saclose, suclose from $library[$y] where dateID = '$id'";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
if($d[$arr[$day]] == "closed")
echo "$libCaps[$y] hours: CLOSED <br>";
if($d[$open[$day]] == "")
{
$count++;
$libs[$count] = $temp[$y];
}
else
{
echo "$libCaps[$y] hours: " . convert($d[$open[$day]]) . " - " . convert($d[$close[$day]]) . "<br>";
}
}
if($count > -1)
{
echo "<br>GENERAL HOURS FOR REST OF LIBRARIES<br><br>";
for($x = 0; $x <= $count; $x++)
{
printGen($libs[$x], $day);
}
}
}
function PrintGeneral($id, $day)
{
//array to days closed
$arr[0] = "suclose";
$arr[1] = "mclose";
$arr[2] = "tclose";
$arr[3] = "wclose";
$arr[4] = "thclose";
$arr[5] = "fclose";
$arr[6] = "saclose";
//days of the week opening time
$open[0] = "suO";
$open[1] = "monO";
$open[2] = "tuO";
$open[3] = "wedO";
$open[4] = "thO";
$open[5] = "fO";
$open[6] = "saO";
//days of the week closing time
$close[0] = "suC";
$close[1] = "monC";
$close[2] = "tuC";
$close[3] = "wedC";
$close[4] = "thC";
$close[5] = "fC";
$close[6] = "saC";
$library[0] = "jerome_regular";
$library[1] = "browne_regular";
$library[2] = "archive_regular";
$library[3] = "curriculum_regular";
$library[4] = "music_regular";
$library[5] = "depository_regular";
$library[6] = "ogg_regular";
$library[7] = "refdesk_regular";
$libCaps[0] = "Jerome Library";
$libCaps[1] = "Browne Popular Culture Library";
$libCaps[2] = "Center for Archival Collections & Historical Collections of the Great Lakes";
$libCaps[3] = "Curriculum Resource Center";
$libCaps[4] = "Music Library and Sound Recordings Archives";
$libCaps[5] = "Northwest Ohio Regional Book Depository (Perrysburg)";
$libCaps[6] = "Ogg Science Library";
$libCaps[7] = "Research/Info Desk - Main floor";
echo "GENERAL HOURS <br><br>";
for($y = 0; $y < 8; $y++)
{
$query = "select dateID, TIME_FORMAT(monO, '%h:%i %p') as monO, TIME_FORMAT(monC, '%h:%i %p') as monC, TIME_FORMAT(tuO, '%h:%i %p') as tuO, TIME_FORMAT(tuC, '%h:%i %p') as tuC, TIME_FORMAT(wedO, '%h:%i %p') as wedO, TIME_FORMAT(wedC, '%h:%i %p') as wedC, TIME_FORMAT(thO, '%h:%i %p') as thO, TIME_FORMAT(thC, '%h:%i %p') as thC, TIME_FORMAT(fO, '%h:%i %p') as fO, TIME_FORMAT(fC, '%h:%i %p') as fC, TIME_FORMAT(saO, '%h:%i %p') as saO, TIME_FORMAT(saC, '%h:%i %p') as saC, TIME_FORMAT(suO, '%h:%i %p') as suO, TIME_FORMAT(suC, '%h:%i %p') as suC, mclose, tclose, wclose, thclose, fclose, saclose, suclose from $library[$y] where dateID = '$id'";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
if($d[$arr[$day]] == "closed")
echo "$libCaps[$y] hours: CLOSED <br>";
else
{
echo "$libCaps[$y] hours: " . convert($d[$open[$day]]) . " - " . convert($d[$close[$day]]) . "<br><br>";
}
}
}
/* This function is called if there is an intersession/extended for one library or more
but not for all libraries. Basically this will default to the regular times for the
the other libraries. */
function printGen($libs, $day)
{
//array to days closed
$arr[0] = "suclose";
$arr[1] = "mclose";
$arr[2] = "tclose";
$arr[3] = "wclose";
$arr[4] = "thclose";
$arr[5] = "fclose";
$arr[6] = "saclose";
//days of the week opening time
$open[0] = "suO";
$open[1] = "monO";
$open[2] = "tuO";
$open[3] = "wedO";
$open[4] = "thO";
$open[5] = "fO";
$open[6] = "saO";
//days of the week closing time
$close[0] = "suC";
$close[1] = "monC";
$close[2] = "tuC";
$close[3] = "wedC";
$close[4] = "thC";
$close[5] = "fC";
$close[6] = "saC";
$query = "select dateID from $libs";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
$id = $d['dateID'];
$query = "select dateID, TIME_FORMAT(monO, '%h:%i %p') as monO, TIME_FORMAT(monC, '%h:%i %p') as monC, TIME_FORMAT(tuO, '%h:%i %p') as tuO, TIME_FORMAT(tuC, '%h:%i %p') as tuC, TIME_FORMAT(wedO, '%h:%i %p') as wedO, TIME_FORMAT(wedC, '%h:%i %p') as wedC, TIME_FORMAT(thO, '%h:%i %p') as thO, TIME_FORMAT(thC, '%h:%i %p') as thC, TIME_FORMAT(fO, '%h:%i %p') as fO, TIME_FORMAT(fC, '%h:%i %p') as fC, TIME_FORMAT(saO, '%h:%i %p') as saO, TIME_FORMAT(saC, '%h:%i %p') as saC, TIME_FORMAT(suO, '%h:%i %p') as suO, TIME_FORMAT(suC, '%h:%i %p') as suC, mclose, tclose, wclose, thclose, fclose, saclose, suclose from $libs where dateID = '$id'";
$result = mysql_query($query) or die ("Invalid query: " .mysql_error());
$d = mysql_fetch_array($result);
if($d[$arr[$day]] == "closed")
echo getName($libs) . " hours: CLOSED <br>";
else
{
echo getName($libs) . " hours: " . convert($d[$open[$day]]) . " - " . convert($d[$close[$day]]) . "<br><br>";
}
}
/*used to get the normal name for the printGen() function */
function getName($lib)
{
if($lib == "jerome_regular")
return "Jerome Library";
else if($lib == "browne_regular")
return "Browne Popular Culture Library";
else if($lib == "archive_regular")
return "Center for Archival Collections & Historical Collections of the Great Lakes";
else if($lib == "curriculum_regular")
return "Curriculum Resource Center";
else if($lib == "music_regular")
return "Music Library and Sound Recordings Archives";
else if($lib == "depository_regular")
return "Northwest Ohio Regional Book Depository (Perrysburg)";
else if($lib == "ogg_regular")
return "Ogg Science Library";
else if($lib == "refdesk_regular")
return "Research/Info Desk - Main floor";
}
?><br>
I think you are going to have to work your way back through the process, exiting your script at certain stages until you can pinpoint the problem -- at least, that is one approach to discovering the issue if you are not receiving any error messages.