voila le code..
<?
require("admin/config.php" );
?>
<html>
<head><title><? echo $myclan ?> - <? echo $title ?></title>
<? echo $style ?>
</head>
<body bgcolor="<? echo $bodycolor ?>" text="<? echo $bodytext ?>">
<p>
<p>
<center><font size=4>MATCHS</font></center></p><center>
<p>
</center><div align=center>
<table border=1 bordercolor='<? echo $bodycolor ?>' cellpadding=0 cellspacing=0 width=200>
<center>
<tr bgcolor='<? echo $toptable ?>'>
<td align=center width='10%'><font color="#FFFFFF">Clan</font></td>
<td align=center width='10%'><font color="#FFFFFF">Date</font></td>
<td align=center width='5%'><font color="#FFFFFF">Country</font></td>
<td align=center width='5%'><font color="#FFFFFF">Results</font></td>
<td align=center width='7%'><font color="#FFFFFF">Scores</font></td>
<td align=center width='5%'><font color="#FFFFFF">Cap.Av.</font></td>
<td align=center width='15%'><font color="#FFFFFF">Maps</font></td>
<td align=center width='10%'><font color="#FFFFFF">League</font></td>
<td align=center width='5%'><font color="#FFFFFF">Report</font></td>
</tr>
<?
$db = mysql_connect("$host", "$login", "$passwd" ) or Die("Base Down !" );
mysql_select_db("$base",$db) or Die("Base Down !" );
$req = mysql_query("SELECT * FROM matchs_tbl ORDER BY date DESC" );
$res = mysql_numrows($req);
$i=0;
WHILE($res!=$i)
{
$id = mysql_result($req,$i,"id" );
$clan = mysql_result($req,$i,"clan" );
$flag = mysql_result($req,$i,"flag" );
$url = mysql_result($req,$i,"url" );
$map1 = mysql_result($req,$i,"map1" );
$map2 = mysql_result($req,$i,"map2" );
$score1us = mysql_result($req,$i,"score1us" );
$score2us = mysql_result($req,$i,"score2us" );
$score1them = mysql_result($req,$i,"score1them" );
$score2them = mysql_result($req,$i,"score2them" );
$scoreustotal = ($score1us + $score2us);
$scorethemtotal = ($score1them + $score2them);
$victory = mysql_result($req,$i,"victory" );
$league = mysql_result($req,$i,"league" );
$goalaverage = ($score1us + $score2us - $score1them - $score2them);
$victory = str_replace("oui","<font color=green>Win</font></a>", $victory);
$victory = str_replace("non","<font color=red>Lost</font></a>", $victory);
$victory = str_replace("nul","<font color=white>Draw</a></font>", $victory);
$report = mysql_result($req,$i,"report" );
if($goalaverage<"0" ){ $goalaverage = "$goalaverage <img src='images/negatif.gif'>"; }
if($goalaverage>"0" ){ $goalaverage = "+$goalaverage <img src='images/positif.gif'>"; }
if($goalaverage=="0" ){ $goalaverage = "0 <img src='images/null.gif'>"; }
if($report=="" ){ $report = "<img src='images/report2.gif'>"; }
if($report=="oui" ){ $report = "<A title='Voir le Rapport du Match contre les $clan' href=matchs_report.php3?id=$id><img src=images/report.gif border=0></a>"; }
$date = mysql_result($req,$i,"date" );
$date_vf = ereg_replace('^([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})$','\\3/\\2/\\1', $date);
$g = mysql_query("SELECT * FROM matchs_tbl WHERE victory='oui'" );
$p = mysql_query("SELECT * FROM matchs_tbl WHERE victory='non'" );
$n = mysql_query("SELECT * FROM matchs_tbl WHERE victory='nul'" );
$winn = mysql_numrows($g);
$lostt = mysql_numrows($p);
$draww = mysql_numrows($n);
$playy = ($winn + $lostt + $draww);
$pourcentagewinn = ($winn / $playy * 100);
$pourcentagelostt = ($lostt / $playy * 100);
$pourcentagedraww = ($draww / $playy * 100);
if(strlen($pourcentagewinn)>4){ $pourcentagewinn = substr($pourcentagewinn,0,4).""; }else{ $pourcentagewinn = "$pourcentagewinn"; }
if(strlen($pourcentagelostt)>4){ $pourcentagelostt = substr($pourcentagelostt,0,4).""; }else{ $pourcentagelostt = "$pourcentagelostt"; }
if(strlen($pourcentagedraww)>4){ $pourcentagedraww = substr($pourcentagedraww,0,4).""; }else{ $pourcentagedraww = "$pourcentagedraww"; }
// array
$table = array(
"D_ROWS" => "<tr bgcolor='$bodytable'>",
"D_COLS" => "<td align=center width='10%'>",
"D_COLS2" => "<td align=center width='15%'>",
"D_COLS3" => "<td align=center width='5%'>",
"D_COLS4" => "<td align=center width='7%'>",
"F_COLS" => "</tr>",
"F_ROWS" => "</td>",
);
$align = array(
"F_CENTER" => "</div>",
"D_RIGHT" => "<div align=right>",
"F_RIGHT" => "</div>"
);
// fin array debut tableau
echo "$table[D_ROWS]";
echo "$table[D_COLS2]";
echo "<a title='Visiter le site des $clan' href=$url target=_blank>$clan</a>";
echo "$table[F_COLS]";
echo "$table[D_COLS]";
echo "$date_vf";
echo "$table[F_COLS]";
echo "$table[D_COLS3]";
echo "<img src='images/$flag.gif'>";
echo "$table[F_COLS]";
echo "$table[D_COLS4]";
echo "$victory";
echo "$table[F_COLS]";
echo "$table[D_COLS4]";
echo "$scoreustotal/$scorethemtotal";
echo "$table[F_COLS]";
echo "$table[D_COLS4]";
echo "$goalaverage";
echo "$table[F_COLS]";
echo "$table[D_COLS2]";
echo "<table width=120 height=1% cols=2><tr height=1><td align=center height=1 width=50%><font size=2><a href=#>$map1</a></font></td><td align=center height=1><font size=2><a href=#>$map2</a></font></td></tr><tr height=1><td align=center height=1><font size=1>( $score1us/$score1them )</font></td><td align=center height=1><font size=1>( $score2us/$score2them )</font></td></tr></table>";
echo "$table[D_COLS]";
echo "$league";
echo "$table[F_COLS]";
echo "$table[D_COLS3]";
echo "$report";
echo "$table[F_COLS]";
echo "$table[F_COLS]";
echo "$table[F_ROWS]";
echo "$table[D_ROWS]";
echo "$table[F_COLS]";
// fin tableau
$i++;
}
mysql_close();
?>
<tr>
<td colspan=9>
<center>
<font size=1>Sur <a title='100%' href=#><B><? echo $playy ?></B></a>
Matchs Joués, Nous comptabilisons <a title='<? echo $pourcentagewinn ?>%' href=#><B><? echo $winn ?></b></a>
Victoires, <a title='<? echo $pourcentagelostt ?>%' href=#><b><? echo $lostt ?></b></a>
Défaites et <a title='<? echo $pourcentagedraww ?>%' href=#><b><? echo $draww ?></b></a>
Nuls.</font>
</center>
</td>
</tr>
</center>
</table>
<p></p>
Message édité par eek le 31-05-2010 à 22:33:23