You are here: Re: [PHP] skip a row in foreach loop « PHP « IT news, forums, messages
Re: [PHP] skip a row in foreach loop

Posted by John Nichel on 08/03/05 18:54

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.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация