MoFish Posted May 4, 2007 Share Posted May 4, 2007 Hello. I'm currently making a league and wanted icons beside the top three positions in the league table: gold, silver and bronze. The code im using appears to be working to some extent, but .. the 4th row is blank all the time. If i add a 4th value to the array, it simply shifts to the 5th row being blank. I cant figure out whats going on here at all. can anyone see the problem? i've been trying to find it out for days now. <?php error_reporting(E_ALL); $colors=array('#DAEBFF', '#DAEBFF', '#DAEBFF'); $images=array('gold1.gif', 'silver1.gif', 'bronze1.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'; } //all my display table is here //echo "<img src='images/" . $image ."'>"; etc }while($row_SelectAllLeague=mysql_fetch_assoc($SelectAllLeague)); ?> Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/ Share on other sites More sharing options...
play_ Posted May 4, 2007 Share Posted May 4, 2007 What is the broken image supposed to be? right click it and view it's path. also, youre using array_shift. that removes the first element of the images array Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245299 Share on other sites More sharing options...
MoFish Posted May 4, 2007 Author Share Posted May 4, 2007 the top three are suppost to be gold.gif silver.gif and bronze.gif, the rest are suppost to be none.gif. source from page = " <td align="center"><img src='images/'></td> " - nothing oh, so if the first element is removed from the array... how does the gold icon still appear? confusing Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245306 Share on other sites More sharing options...
play_ Posted May 4, 2007 Share Posted May 4, 2007 try this <?php error_reporting(E_ALL); $colors=array('#DAEBFF', '#DAEBFF', '#DAEBFF'); $images=array('gold1.gif', 'silver1.gif', 'bronze1.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)){ $image='none.gif'; } //all my display table is here //echo "<img src='images/" . $image ."'>"; etc }while($row_SelectAllLeague=mysql_fetch_assoc($SelectAllLeague)); ?> Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245314 Share on other sites More sharing options...
MoFish Posted May 4, 2007 Author Share Posted May 4, 2007 tryed that and got the following: Parse error: syntax error, unexpected $end in D:\league.php on line 111 Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245316 Share on other sites More sharing options...
play_ Posted May 4, 2007 Share Posted May 4, 2007 I am probably missing a closing bracket } this: if(isset($images)){ $image=array_shift($images); if(is_null($image)){ $image='none.gif'; } should be this if(isset($images)){ $image=array_shift($images); if(is_null($image)){ $image='none.gif'; } } Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245317 Share on other sites More sharing options...
MoFish Posted May 4, 2007 Author Share Posted May 4, 2007 thats it working! thank you so much! thats been anoying me for days now. mofish Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245318 Share on other sites More sharing options...
play_ Posted May 4, 2007 Share Posted May 4, 2007 no problem. glad to help : ) Link to comment https://forums.phpfreaks.com/topic/49969-solved-top-three-results/#findComment-245320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.