MoFish Posted April 30, 2007 Share Posted April 30, 2007 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 <?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 More sharing options...
neel_basu Posted April 30, 2007 Share Posted April 30, 2007 The Source code you posted Doesn't generate the Page on . 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 https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241467 Share on other sites More sharing options...
MoFish Posted April 30, 2007 Author Share Posted April 30, 2007 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 https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241471 Share on other sites More sharing options...
neel_basu Posted April 30, 2007 Share Posted April 30, 2007 Try <?php echo "img src='images/" . $image .""; ?> Instead of that And send the output Link to comment https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241497 Share on other sites More sharing options...
MoFish Posted April 30, 2007 Author Share Posted April 30, 2007 results: Link to comment https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241500 Share on other sites More sharing options...
neel_basu Posted April 30, 2007 Share Posted April 30, 2007 AS you are using array_shift() I thinkthe 4th Value is Getting Erased. Add error_reporting(E_ALL); at the Top of your Page. Link to comment https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241688 Share on other sites More sharing options...
MoFish Posted April 30, 2007 Author Share Posted April 30, 2007 gold.gif bronze.gif silver.gif none.gif none.gif none.gif none.gif so its missing a none.gif :-\ whyyyyyyy lol Link to comment https://forums.phpfreaks.com/topic/49275-if-statement-missing-image/#findComment-241873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.