Reply to Re: PHP Foreach HELP!

Your name:

Reply:


Posted by matt on 10/24/07 11:34

matt wrote:
> Steve wrote:
>
>>> The line
>>
>>
>>
>>>> if ( $g != $gallery ) next($line);
>>>
>>>
>>> should be replaced by
>>>
>>> if ( $g != $gallery ) continue;
>>
>>
>>
>> After the correct gallery is found this solution will waste cycles
>> looking at entries that will not match.
>>
>> ---
>> Steve
>>
>
> Thanks for all the responses.
>
> As it is a flat file that is used for all galleries, and it appends a
> line to the bottom of the file each time a record is added, the
> galleries are mixed up throughout the file, so if it stops as soon as
> the first match is found, it will not print the rest of the records out.
>
> I will try the "continue" method and see how it works.


The Continue Method is causing me problems, After the first instance
where $g != $gallery, it goes to the end of the code and closes the
table... then it goes back and prints the second photo, causing the
second image to not be inside the table that is opened at the start of
the code (I have pasted complete html result at the bottom:)

<table border=1 width=500 align=center><td width=50% valign=top><img
src='photo1.jpg' width=220><br>Test<br><a
href="photo1.jpg">Enlarge</a><br><br></td></table><td width=50%
valign=top><img src='photo2.jpg' width=220><br>Test2<br><a
href="photo2.jpg">Enlarge</a><br><br></td><tr></table>

[Back to original 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

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