Jump to content

file_exists help load users avatar & blank image


Willuk1983

Recommended Posts

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

  • 4 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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