Re: skip a row in foreach loop

From: Date: Wed, 03 Aug 2005 15:59:31 +0000
Subject: Re: skip a row in foreach loop
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-219908@lists.php.net to get a copy of this message
Yes, it comes fro DB, but, quesry is alerady "to complex" (for me :)) with union, joint, ... and expanding with something else ill take additional few hours to figure it out. And, Stut's and Chris' "continue" solution sound perfect for me :) Thanks guys on such a fast respond! -afan John Nichel wrote:
afan@afan.net wrote:
I have a code foreach($results as $key => $value) { echo $key.': '. $value .'<br>'; } But, $value could be zero too. How to skip printing on screen when $vlaue == 0? I know I can do foreach($results as $key => $value) { if(!empty($value)) {
       echo $key.': '. $value .'<br>';
} }
Is $results coming from a db? Select only the rows which do not have a value of 0.


« previous php.general (#219908) next »