Jump to content

[SOLVED] Maximum execution time of 30 seconds exceeded


rondog

Recommended Posts

Ok I made a for loop and all of a sudden this server I am working on is giving me this error:

 

 

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Inetpub\vhosts\drewestate.com\httpdocs\new\2008\galleryeditor.php on line 32

 

<?php
include 'connect.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
if(isset($_GET['action'])) {
switch($_GET['action']) {
case "edit":
	if(isset($_GET['id'])) {
		$query = mysql_query("SELECT * FROM de_images WHERE galleryid = '".$_GET['id']."'") or die(mysql_error());
		$namequery = mysql_query("SELECT galleryName FROM de_galleries WHERE id = '".$_GET['id']."'") or die(mysql_error());
		$name = mysql_fetch_row($namequery);
		$content = "<fieldset><legend>Editing the \"$name[0]\" Gallery.</legend>\n";
		$content .= "<form method=\"post\">\n";
		$count = 0;
		while($row = mysql_fetch_array($query)) {
			$count += 1;
			$content .= "<img src=\"gallery/$row[image]\" width=\"50%\" height=\"50%\"/><br>\n";
			$content .= "<input type=\"text\" name=\"caption$count\"value=\"$row[caption]\" /><br><br>\n\n";
		}
		$content .= "<input type=\"submit\" name=\"save\" value=\"Save Changes\" />\n</form>\n";
		$content .= "</fieldset>";
		if(isset($_POST['save'])) {
			$captions = array();
			for($i = 0;i<$count;$i++) {
				array_push($captions,$_POST['caption$i');
			}
			print_r($captions);
		}
	} else {
		$query = mysql_query("SELECT * FROM de_galleries") or die(mysql_error());
		$content = "<fieldset><legend>Select a gallery to edit</legend>";
		while($row = mysql_fetch_array($query)) {
			$content .= "<img src=\"gallery/$row[thumbnail]\" /><br>\n";
			$content .= "<a href=\"?action=edit&id=$row[id]\">$row[galleryName]</a><br>\n";
		}
		$content .= "</fieldset>";
	}
break;
case "add":
	$content = "add a gallery.";
break;
}
}
?>
<table width="500" border="0" align="center">
  <tr>
    <td><img src="images/drew-estate-logo-blue1.gif" alt="" width="100" height="100" /></td>
  </tr>
  <tr>
    <td><a href="?action=edit">Edit Gallery</a> | <a href="?action=add">Add Gallery</a></td>
  </tr>
  <tr>
    <td><?php echo $content; ?></td>
  </tr>
</table>
</body>
</html>

 

basically what I am doing here is outputting N number of images depending on whats in the DB. My for loop is to post the caption input text fields. The reason I am using a loop is because the same number of input fields aren't always the same so I want to store them into an array and then use that array to insert data into the DB. What do you think the problem is?

 

Also I labeled line 32 so you can see it.

rather than making another topic, I figured I would ask here..I need to post numerous text fields called "caption0","caption1","caption2" etc...that was the reason I used a for loop. I tried:

 

for($i = 0;$i<$count;$i++) {
$cap = $_POST['caption'+$i];
array_push($captions,$cap);
}

AND

for($i = 0;$i<$count;$i++) {
$cap = $_POST['caption$i'];
array_push($captions,$cap);
}

 

and neither have worked..what should i do?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.