On Mon,  9 Apr 2001 14:27, Yo Bro wrote:
> I do have a matching image, and all cases it does work with different
> records from the database. IE Where there might be an array of 15
> items, but it is always the last one that doesn't show. Even if the
> image is there, because it gets used if i add another value to the
> array. IE
> PS|PW|AC|CD
>
> In this case all but CD would be displayed.
> Still no luck.
>
> I noticed your code used if (!file_exists
> Where as I want to check if it does exist. Is your way worth a try?

Had to do that because, of course, I don't have the image files :-) You 
could try it....

>
> "David Robley" <[EMAIL PROTECTED]> wrote in message
> 01040914213301.26561@www">news:01040914213301.26561@www...
>
> : 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]

Reply via email to