Jump to content

If Statement & Missing Image


MoFish

Recommended Posts

Hello..

 

Im using the following code to display different images and colours beside the top three values from database, but am getting one missing for some reason. Im not quite sure why its not displaying the silver flag. anyone got any ideas?

 

Thanks MoFish

 

missingimagephpsy0.jpg

 

<?php
$colors=array('#DAEBFF', '#DAEBFF', '#DAEBFF');
$images=array('gold.gif', 'bronze.gif', 'silver.gif');
do{
if(isset($colors)){
  $color=array_shift($colors);
  if(is_null($color)){
   unset($colors);
  }
}else{
  $color='#C4DFFF';
}
if(isset($images)){
  $image=array_shift($images);
  if(is_null($image)){
   unset($images);
  }
}else{
  $image='none.gif';
}
?>

Link to comment
Share on other sites

The Source code you posted Doesn't generate the Page on missingimagephpsy0.jpg. Post the Actual code.

And also the code has no meaning

if(isset($colors)){
  $color=array_shift($colors);
  if(is_null($color)){//It should be !is_array()
   unset($colors);
  }

And also Post the HTML Source of that output page (But dont Post teh full source post teh HTML source of that portion only).

Link to comment
Share on other sites

what do you mean its not from that page? that statement i posted sets the value of image which is then displayed.

 

gold.gif = green icon

silver.gif  = orange icon

bronze.gif = blue icon

none.gif = the white icon

 

once the value of $image has been set i simply am echo'ing it to the page using

 

<?php echo "<img src='images/" . $image ."'>"; ?>

 

the colour section works. seems to be working for the rest, its just the 4th row, none of them work for.

 

source from page:

 

<tr style='background-color: '>

<td align="center"><img src='images/'></td>

<td style="color:#663399"><b>Daz</b></td>

 

dont know why they are blank on the 4th value only.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.