RE: [PHP] Infinite Loop Issue

From: Date: Fri, 07 Nov 2008 16:40:51 +0000
Subject: RE: [PHP] Infinite Loop Issue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-283078@lists.php.net to get a copy of this message
[snip] while($all->fetch()){ $i = 0; $iss_link = explode(', ', $issues); foreach($iss_link as $a){ $row2[$i] = "<a href=\"http://mantisus/view.php?id=$a\" target=\"_blank\">".$a.'</a>'; $i++; } $issues = implode(', ', $row2); echo $release_id; echo $description; echo $date; echo $issues; echo $priority; echo '<br />'; } $all->close(); } [/snip] Is the while statement infinite or is the foreach infinite? The infinite loop appears to be coming from $issues that never equates to empty or false. Before $iss_link = explode(', ', $issues); you may want to check the state of $issues like if('' != $issues). Right now I can see that $issues is not empty because in the while loop you populate $issues with $issues = implode(', ', $row2); the next time the while loop comes around $issues is still full of stuff. You might want to try unsetting $issues at the end of the while and then when it comes around again $issues should be populated by the database query.

« previous php.general (#283078) next »