PHP script dies after while loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • majortopio
    New Member
    • Aug 2011
    • 1

    PHP script dies after while loop

    So I have this while loop in a function that is called in the middle of a page:

    Code:
    			while(count($showarray) <= $show_link){
    				$randindex = rand(0, count($newlinks));
    				if(!in_array($newlinks[$randindex], $showarray) && $newlinks[$randindex] != "") {
    					$showarray[$showindex] = $newlinks[$randindex];
    					//print_r($showarray);
    					$showindex++;
    				}
    			}
    The funny thing is: it works for one page (it's used to list randomly generated links depending on which ID is taken from the URL) - that is, where ID = 1, but on all other pages, it just kills the script and nothing after it is outputted. I would really appreciate any help on figuring this out.
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    there's an error. make sure you have read this:



    Turn error reporting on and you'll be able to see the problem faster than us humans manually debugging your code.

    Comment

    Working...