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'; } ?> Quote Link to comment 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). Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
MoFish Posted April 30, 2007 Author Share Posted April 30, 2007 results: Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.