Re: This loop is screwed up totally. Why o why o why....
| From: | Yo Bro | Date: | Mon, 09 Apr 2001 20:50:02 +0000 |
| Subject: | Re: This loop is screwed up totally. Why o why o why.... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-47880@lists.php.net to get a copy of this message | ||
Thanks for your answer.
I tried what you suggested and got the result I expected. They all appear
fine. It is only when i loop the array after exploding it, and then
attempting to get it to load an image that it doesn't show the last value.
The code I have got here works, but the else statement I need to use for
something else.
For this example the feild in the DB is - FULL|DOHC|EFI to make life easy.
$specs = $myrow[features];
echo " echoing specs - $specs"; //This echos FULL|DOHC|EFI
$features = explode('|',$specs); //What the feild is delimited by '|'
reset ($features);
print_r ($features); //This prints Array ( [0] => FULL [1] => DOHC [2] =>
EFI )
while (list(, $feature) = each ($features)) {
if (file_exists("features/$feature.gif")){
echo "<img src=\"features/$feature.gif\"><br>";
} //This displays FILL.gif & DOHC.gif but not EFI.gif
} //End While
If the example was FILL|DOHC|EFI|SP
All images would display except SP.gif
this is weird.
"Philip Olson" <philip@cornado.com> wrote in message
news:Pine.BSF.4.10.10104090640130.46638-100000@localhost...
: What does this do?
:
: > $specs = $myrow['features'];
:
: print $specs;
:
: > $features = explode('|',$specs); //What the feild is delimited by
'|'
:
: print_r($features);
:
: Does it include the missing last value within the $features array? Does
: $specs look okay?
:
: Regards,
: Philip
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
: For additional commands, e-mail: php-general-help@lists.php.net
: To contact the list administrators, e-mail: php-list-admin@lists.php.net
: