This loop is screwed up totally. Why o why o why....

From: Date: Mon, 09 Apr 2001 04:26:03 +0000
Subject: This loop is screwed up totally. Why o why o why....
Groups: php.general 
Request: Send a blank email to php-general+get-47713@lists.php.net to get a copy of this message
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 ------------------------------------------------------------- DO NOT REPLY TO THIS VIA EMAIL PLEASE USE THE NEWSGROUP All emails sent to this address are automatically deleted. This is to avoid SPAM! -------------------------------------------------------------

« previous php.general (#47713) next »