Sorry for the long bit of posting here but I can't find my error. I have stared at this for a few hours now. I'm kind of new to PHP but I would say I know a bit more than a newbie. Here is the code. Let me know if you can find it. The browser keeps telling me on line 330 but we all know how awesome the browser trouble shoots for us.
<?php
$db = mysql_pconnect('localhost', 'menu', 'system');
if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
mysql_select_db('menus');
echo '<br />';
$mpstatus = 0;
$denstatus = 0;
if (date("l") == "Saturday")
{
if (date("G") >= "8" || date("G") < "20")
{
$mpstatus = 1;
}
if (date("G") >= "10" || date("G") < "19")
{
$denstatus = 1;
}
if ($mpstatus == 1)
{
if (date("G") >= "8" && date("G") < "11")
{
$mpmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$mpmeal = "Lunch";
}
if (date("G") >= "15")
{
$mpmeal = "Dinner";
}
}
if ($denstatus == 1)
{
if (date("G") >= "10" && date("G") < "11")
{
$denmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$denmeal = "Lunch";
}
if (date("G") >= "15")
{
$denmeal = "Dinner";
}
}
}
if (date("l") == "Sunday")
{
if (date("G") >= "10" || date("G") < "20")
{
$mpstatus = 1;
}
if (date("G") >= "10" || date("G") < "19")
{
$denstatus = 1;
}
if ($mpstatus == 1)
{
if (date("G") >= "10" && date("G") < "11")
{
$mpmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$mpmeal = "Lunch";
}
if (date("G") >= "15")
{
$mpmeal = "Dinner";
}
}
if ($denstatus == 1)
{
if (date("G") >= "10" && date("G") < "11")
{
$denmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$denmeal = "Lunch";
}
if (date("G") >= "15")
{
$denmeal = "Dinner";
}
}
}
if (date("l") == "Monday" || date("l") == "Tuesday" || date("l") == "Wednesday" || date("l") == "Thursday")
{
if (date("G") >= "7" || date("G") < "21")
{
$mpstatus = 1;
}
if (date("G") >= "7" || date("G") < "20")
{
$denstatus = 1;
}
if ($mpstatus == 1)
{
if (date("G") >= "7" && date("G") < "11")
{
$mpmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$mpmeal = "Lunch";
}
if (date("G") >= "15")
{
$mpmeal = "Dinner";
}
}
if ($denstatus == 1)
{
if (date("G") >= "7" && date("G") < "11")
{
$denmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$denmeal = "Lunch";
}
if (date("G") >= "15")
{
$denmeal = "Dinner";
}
}
}
if (date("l") == "Friday")
{
if (date("G") >= "7" || date("G") < "20")
{
$mpstatus = 1;
}
if (date("G") >= "7" || date("G") < "20")
{
$denstatus = 1;
}
if ($mpstatus == 1)
{
if (date("G") >= "7" && date("G") < "11")
{
$mpmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$mpmeal = "Lunch";
}
if (date("G") >= "15")
{
$mpmeal = "Dinner";
}
}
if ($denstatus == 1)
{
if (date("G") >= "7" && date("G") < "11")
{
$denmeal = "Breakfast";
}
if (date("G") > "11" && date("G") < "15")
{
$denmeal = "Lunch";
}
if (date("G") >= "15")
{
$denmeal = "Dinner";
}
}
}
if ($denstatus == 1)
{
$query = "select menu from den where ((day = '" . date("l") . "') and (meal = '" . $denmeal . "'))";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
echo '<b>Now Serving @ the Wildcat Den:</b>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo '<br />';
echo (stripslashes($row['menu']));
}
} else {
echo 'The Wildcat Den is currently closed';
}
echo '<hr align="center" width="75%">';
if ($mpstatus == 1)
{
$querymp = "select menu from mp where ((day = '" . date("l") . "') and (meal = '" . $mpmeal . "'))";
$resultmp = mysql_query($querymp);
$num_resultsmp = mysql_num_rows($resultmp);
echo '<b>Now Serving @ Marketplace:</b>';
for ($i=0; $i <$num_resultsmp; $i++)
{
$rowmp = mysql_fetch_array($resultmp);
echo '<br />';
echo (stripslashes($rowmp['menu']));
}
} else {
echo 'Marketplace is currently closed';
}
mysql_close();
}
?>
Thanks
If you have any suggestions email me cklosows@nmu.edu or hit me up on a messenger
AIM: Emb3rX
MSN: klosochr@hotmail.com
Yahoo!: aaaemberaaa@yahoo.com