Reply to PHP Foreach HELP!

Your name:

Reply:


Posted by matt on 11/17/31 11:34

I have this bit of code, that isn't valid, and I need some help getting
it to work... Currently, I get an error because I am calling the next()
function within a foreach loop. I am opening a flat file with data in
the format of:

01|data1|data2

01 Being Gallery Name, data1 being the filename, data2 being photo caption.

Basically I need to look at the line from the text file, and if the
first 2 digits do not match the gallery I have specified, then move on
to the next line, completely ignoring the first line... Code follows:


I would appreciate any help...

<?

$gallery = 03;

$data = file('gallery.txt');

echo "<table border=0 width=500 align=center>";
foreach ($data as $line)
{
list ($g, $q, $a) = explode('|' , trim($line) );
if ( $g != $gallery ) next($line);
else
{
echo "<td width=50% valign=top><img src='/gallery/$q' width=220><br>";
echo "$a<br>";
echo "<a href=\"/gallery/$q\">Enlarge</a><br><br></td>";
$ee++;
//2 - row
if($ee%2==0) echo "<tr>";
}
echo "</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

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