Seite 1 von 1

code für rank... fehler in funktion... bild ist nicht da!

Verfasst: 29.12.2005 11:46
von 123teddy321
hallo!

ich habe ein kleines, wirklich nur kleines problemchen!!!
erstmal der code, der das probelm ausl�st:

Code: Alles auswählen

<?phpS

$getit = "SELECT * FROM `haters` ORDER BY `hits` ASC";
$printit = mysql_query($getit);
while($tmp = mysql_fetch_object($printit))
	{
	
	function rankimg()
	{
	if($tmp->hits < "100")
	{
	$rank = "rank_0.gif";
	}
	if($tmp->hits < "300" && $tmp->hits > "101")
	{
	$rank = "rank_1.gif";
	}
	if($tmp->hits < "600" && $tmp->hits > "301")
	{
	$rank = "rank_2.gif";
	}
	if($tmp->hits < "1200" && $tmp->hits > "601")
	{
	$rank = "rank_3.gif";
	}
	if($tmp->hits < "2000" && $tmp->hits > "1201")
	{
	$rank = "rank_4.gif";
	}
	if($tmp->hits > "3500")
	{
	$rank = "rank_5.gif";
	}
	}

	rankimg("
		echo("<table width="60%" align="center">");
		echo("
			<tr>
				<td><img src="img/".$rank.""></td>
				<td width="50%">".$tmp->username."</td>
				<td>".$tmp->hits."</td>
			</tr>
		");
		echo("</table>");
		");
	}


?>
der code gibt eine tabelle aus, in der username und anzahl der hits aus einer datenbank ausgelesen werden und die funktion soll anhand der anzahl der hits das entsprechende rank image hin machen!

Code: Alles auswählen

#-----------#--------#--------#
#  rankimg  #  name  #  hits  #
#-----------#--------#--------#
so soll es ungef�hr aussehen!
nur gibt mir mein XAMPP nun folgende fehlermeldung aus:
xampp fehlermeldung hat geschrieben:Fatal error: Cannot redeclare rankimg() (previously declared in C:\Dokumente und Einstellungen\lalelu\Eigene Dateien\xampp-win32-1.4.16\xampp\htdocs\tokio\show\users.php:10) in C:\Dokumente und Einstellungen\lalelu\Eigene Dateien\xampp-win32-1.4.16\xampp\htdocs\tokio\show\users.php on line 8
die zeile acht ist

Code: Alles auswählen

	function rankimg() 
ich hoffe mir kann jemand helfen, ist wirklich wichtig! danke schonmal im vorraus!

euer floo[/code]