On Mon, 9 Apr 2001 13:56, you wrote: > Hi I have a feild in a MySql database called features. It is delimited > by | the line above the \ key. > Anyway, the feild has things like PS|PW|AC etc in it. > I have the code below to explode that feild. It all works fine, but > when it comes to looping the code below it always misses that last > value. (Example - AC) > Only in the IF statement - if i echo the variable "$feature" out of the > IF statment it prints the text fine. But i need it to check for the > existance of a gif first to display in the window. > As you will see I have gifs with the names and the variable $feature > ends with .gif > It works great, but it misses the last value to the array $feature. > Any ideas. > > $specs = $myrow[features]; > > $features = explode('|',$specs); //What the feild is delimited by > '|' reset ($features); > > while (list(, $feature) = each ($features)) { > > if (file_exists("features/$feature.gif")){ > echo "<img src=\"features/$feature.gif\"><br>"; > echo "$feature"; > } > > } //End While > > > -- > Regards, > > > YoBro This seems to work OK for me: <?php $specs = "PS|PW|AC"; $features = explode('|',$specs); //What the feild is delimited by '|' reset ($features); while (list(, $feature) = each ($features)) { if (!file_exists("features/$feature.gif")){ echo "<img src=\"features/$feature.gif\">"; echo "$feature<br>\n"; } } //End While ?> Is it possible that you don't hve a matching image for the last item? -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]