Jump to content

Fatal error: Maximum execution time of 60 seconds exceeded


Recommended Posts

Hello, i created the following code but get the following error message:

 

<html>
<head>
<title></title>
</head>
<body>


<table border="1" id="kalender" width="900" cellpadding="0" cellspacing="0">
<tr>
<td width="20"></td>
<td width="30">maandag</td>
<td width="30">dinsdag</td>
<td width="30">woensdag</td>
<td width="30">donderdag</td>
<td width="30">vrijdag</td>
<td width="30">zaterdag</td>
<td width="30">zondag</td>
</tr>
<?

include ("array.php");
$calendartype = "week";

for($i = 0; $i <= 23; $i++)
{
echo "<tr height='20'><td width='20'>";
}

for($i = 0; $i <= 23; $i++)
{
$number = $i;
$date = ConvertToDateTime($number,$calendartype);
foreach($array as $val)
	{
	$s_date = strtotime($val['start']);
	$e_date = strtotime($val['end']);

	$countres = 0;

	if($date > $s_date && $date < $e_date) //als de gekozen datum tussen de start en enddate ligt
		{
		$countres++;
		$hours = $e_date - $s_date;
			for($i=0; $i<=$countres; $i++)
			{
			$width = 30 / $countres;
			echo "<td width=$width rowspan=$hours";
			}
		}
	}

}


function ConvertToDateTime($number,$calendartype)
{
if ($calendartype == "week"){
$time = date("$number:00:00 2009-03-02");
$date = strtotime($time);
}
if ($calendartype == "month"){
$day = date("00:00:00 2009-03-$number");
$date = strtotime($day);
}
return $date;
}


?>
</table>
</body>
</html>

 

Fatal error: Maximum execution time of 60 seconds exceeded

 

What do i wrong?

I did, but everything looks fine. Now i tried something and i know that if i remove the following lines:

 

$s_date = strtotime($val['start']);

$e_date = strtotime($val['end']);

 

the page shows up without any error, bit it does not work cause these variables are not converted. Waht's wrong about these lines?

You do realize that you have a for ($i inside of a for $i, this i is being reset each time you loop through and thus sending you into an infinite loop.

 

Change the inner $i to something different like $x and this should help, if not solve your problem.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.