PDA

View Full Version : Fatal Error, time exceeded.


Red Blaze
02-08-2006, 04:03 PM
I get a Fatal Error Maximum execution time of 30 seconds exceeded on line 19.


while($counter <= count($photos_uploaded)) {
if($photos_uploaded['size'][$counter] > 0) {
if(!array_key_exists($photos_uploaded['type'][$counter], $photo_types)) {
$result_final .= 'File ' . ($counter + 1) .
' is not a photo<br />';
} else {
// Great the file is an image, we will add this file
}
}
}


That's the block of code that starts at line 19. Any way I can make the code simpler so that it won't exceed the 30 second execution limit?

Xenon
02-08-2006, 05:29 PM
don't allow to much photo uploads at the same time

Red Blaze
02-08-2006, 06:25 PM
Oddly enough, not even one will go through. :p

I downloaded a file that was already done, from the tutorial I was reading and it works just fine. I must of missed something.

Ok, the uploading works well already. Granted, I still need testing with it. But here's the viewgallery page.

http://www.pro-photos.com/uploading/viewgallery.php

If you give it time, or maybe right off the bat, you'll get errors. In a short time, they'll go away and it'll be as if they were never there. In time, they'll show up again. Why does that happen? I really don't understand.

filburt1
02-08-2006, 06:46 PM
Increment your counter.

Xenon
02-08-2006, 07:31 PM
oops ^^

right, you are not incrementing the counter variable, so it's an endless loop

Red Blaze
02-08-2006, 08:15 PM
uh huh. o.o;
Sorry, that's one thing I'm not sure how to do. Here's my block of code:


$result = mysql_query( "SELECT c.album_id,c.album_name,COUNT(photo_id)
FROM gallery_albums
WHERE customer = '".$customer."' as c
LEFT JOIN gallery_photos as p ON p.photo_album = c.album_id
GROUP BY c.album_id" );
line 27-> while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href='viewgallery.php?aid=".$row[0]."'>".$row[1]."</a> "."(".$row[2].")";
}
line 31-> mysql_free_result( $result );

Right now, it's giving errors saying:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/prophot/public_html/uploading/viewgallery.php on line 27

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/prophot/public_html/uploading/viewgallery.php on line 31

But if I take off "WHERE customer = '".$customer."'", the errors go *poof*. I want to filter the albums by customer so only THAT logged in customer views his/her albums and not anyone elses. <=/

filburt1
02-08-2006, 11:21 PM
The query probably failed (and certainly did given it's not syntactually valid).