Re: skip a row in foreach loop
| From: | John Nichel | Date: | Wed, 03 Aug 2005 15:54:22 +0000 |
| Subject: | Re: skip a row in foreach loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219904@lists.php.net to get a copy of this message | ||
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)) {Is $results coming from a db? Select only the rows which do not have a value of 0. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@kegworks.comecho $key.': '. $value .'<br>';} }