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
https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/
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).

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.