Willuk1983 Posted March 29, 2011 Share Posted March 29, 2011 Hi ppl got code problem cant get it show users avatar & blank avatar at same time not that good at php ppl. avatar box page <style type="text/css"> #name_area{height:20px; padding:3px;}; </style> <script language="javascript"> <!-- function member_change(id){ <?php $allgames = mysql_query("SELECT * FROM games") or die (mysql_error()); $allgames_total = @mysql_num_rows($allgames); if($allgames_total!=0) { $i=0; while($i<$allgames_total) { ?> document.getElementById('<?php echo mysql_result($allgames, $i, 'game_id'); ?>').style.display = "none"; <?php $i++; } } ?> document.getElementById(id).style.display = "block"; } function show_name(name){ document.getElementById('name_area').innerHTML = name; } function hide_name(){ document.getElementById('name_area').innerHTML = ''; } //--> </script> <div style="text-align:left;"> Choose Squad: <select name="D1" onchange="member_change(this.options[this.selectedIndex].value)" class="standardforms"> <?php $allgames = mysql_query("SELECT * FROM games") or die (mysql_error()); $allgames_total = @mysql_num_rows($allgames); if($allgames_total!=0) { $i=0; while($i<$allgames_total) { $game = mysql_result($allgames, $i, 'game_title'); $members_total2 = mysql_num_rows(mysql_query("SELECT * FROM members WHERE game = '$game'")); if($members_total2!=0) { ?> <option value="<?php echo mysql_result($allgames, $i, 'game_id'); ?>"><?php echo mysql_result($allgames, $i, 'game_title'); ?></option> <?php } $i++; } } ?> </select><br /><br /> </div> <?php $allgames = mysql_query("SELECT * FROM games") or die (mysql_error()); $allgames_total = @mysql_num_rows($allgames); if($allgames_total!=0) { $i=0; while($i<$allgames_total) { $game = mysql_result($allgames, $i, 'game_title'); $members = mysql_query("SELECT * FROM members WHERE game = '$game'"); $members_total = @mysql_num_rows($members); if($allgames_total!=0) { ?> <div id="<?php echo mysql_result($allgames, $i, 'game_id'); ?>" style="display: block; text-align:left;"> <?php if($members_total!=0) { $d=0; while($d<$members_total) { ?> <a href="index.php?page=members&id=<?php echo mysql_result($members, $d, 'id'); ?>"><img onmouseover="show_name('<?php echo mysql_result($members, $d, 'username'); ?>')" onmouseout="hide_name()" src="user/<?php echo mysql_result($members, $d, 'avatar_link'); $filename = 'avatar_link'; if (file_exists($filename)) { echo "avatar_link"; } else { echo "avatars/blank.jpg"; } ?>" width="50" height="50" alt="<?php echo mysql_result($members, $d, 'username'); ?>" title="<?php echo mysql_result($members, $d, 'username'); ?>"/></a> <?php $d++; } } } echo "</div>"; $i++; } } ?> <div id="name_area"></div> Quote Link to comment https://forums.phpfreaks.com/topic/232082-file_exists-help-load-users-avatar-blank-image/ Share on other sites More sharing options...
Maq Posted March 29, 2011 Share Posted March 29, 2011 Please use tags when posting code in the future. Please be conscious of where you're posting. This doesn't seem to be a regex question (I moved it). What have you done to isolate the problem? There is a lot of code there. Quote Link to comment https://forums.phpfreaks.com/topic/232082-file_exists-help-load-users-avatar-blank-image/#findComment-1193872 Share on other sites More sharing options...
Willuk1983 Posted March 29, 2011 Author Share Posted March 29, 2011 Ok sorry m8 not post on forum sit b4 this bit code have problem with try get avatar image show and if have no image show blank one like avatar/blank.gif try code it like 100 times now get one image not other at same time kill me be do it for 8 week now lol <a href="index.php?page=members&id=<?php echo mysql_result($members, $d, 'id'); ?>"><img onmouseover="show_name('<?php echo mysql_result($members, $d, 'username'); ?>')" onmouseout="hide_name()" src="user/<?php echo mysql_result($members, $d, 'avatar_link'); ?>" width="50" height="50" alt="<?php echo mysql_result($members, $d, 'username'); ?>" title="<?php echo mysql_result($members, $d, 'username'); ?>"/></a> Quote Link to comment https://forums.phpfreaks.com/topic/232082-file_exists-help-load-users-avatar-blank-image/#findComment-1193902 Share on other sites More sharing options...
Willuk1983 Posted April 26, 2011 Author Share Posted April 26, 2011 Problem fix Aye add hidden in register page Thanks Quote Link to comment https://forums.phpfreaks.com/topic/232082-file_exists-help-load-users-avatar-blank-image/#findComment-1206211 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.