#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    64
    Rep Power
    2

    Loop Timeout? - Max Execution Time


    For some reason I keep getting a max execution time error at the while loop and I'm not sure what I missed.

    Example URL: domain.com/?img=1

    PHP Code:
    $getNext rand(1,$count[0]);
    $next $selectedImages[$getNext][0];
        
        while(
    $next == $_GET['img']){
                
    $getNext rand(1,$count[0]);
                
    $next $selectedImages[$getNext][0];
        } 
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,068
    Rep Power
    9398
    Methinks what is happening depends on $count and $selectedImages.

    I suspect that if $count[0] == 1 then your loop will keep looking for the "next" image when there isn't one.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    64
    Rep Power
    2
    Originally Posted by requinix
    Methinks what is happening depends on $count and $selectedImages.

    I suspect that if $count[0] == 1 then your loop will keep looking for the "next" image when there isn't one.
    Yeah i must have missed something that is changing the count, I'll go back and check.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    64
    Rep Power
    2
    Hmm...

    PHP Code:
    print_r($count); 
    Produces a result of 11. Not sure if this is worth mentioning, but if i change the while loop to an IF statement $next remains the same value.

    So i'm not sure what's going on yet.

    UPDATE: $count[0] is getting changed to 1. Just need to find where, thanks.

IMN logo majestic logo threadwatch logo seochat tools logo