Jeg tror jeg har den nu
Config.php
<?PHP
DEFINE ('DB_USER', 'BRUGERNAVN');
DEFINE ('DB_PASSWORD', 'PASSWORD');
DEFINE ('DB_HOST', 'HOST');
DEFINE ('DB_NAME', 'DATABASENAVN');
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error() );
@mysql_select_db (DB_NAME) OR die ('Could not select database: ' . mysql_error() );
?>
Index.php
<?PHP
include('Config.php');
$kampe = mysql_query("SELECT spillernavn, COUNT(spillerid) FROM kampe GROUP BY spillerid ORDER BY COUNT(spillerid) DESC")or die("MySQL fejl: " . mysql_error());
$maal = mysql_query("SELECT COUNT(assist) FROM maal WHERE assist='0' GROUP BY spillerid")or die("MySQL fejl: " . mysql_error());
$maal = mysql_result($maal,0);
$assist = mysql_query("SELECT COUNT(assist) FROM maal WHERE assist='1' GROUP BY spillerid")or die("MySQL fejl: " . mysql_error());
$assist = mysql_result($assist,0);
$gule = mysql_query("SELECT COUNT(type) FROM kort WHERE assist='0' GROUP BY spillerid")or die("MySQL fejl: " . mysql_error());
$gule = mysql_result($gule,0);
$rode = mysql_query("SELECT COUNT(type) FROM kort WHERE assist='1' GROUP BY spillerid")or die("MySQL fejl: " . mysql_error());
$rode = mysql_result($rode,0);
echo "<table border='1'>
<tr>
<th>Spiller</th>
<th>Kampe</th>
<th>Mål</th>
<th>Assist</th>
<th>Gule kort</th>
<th>Røde kort</th>
</tr>
";
while($row = mysql_fetch_array($kampe)) {
echo "<tr>";
echo "<td>" . $row['spillernavn'] . "</td>";
echo "<td>" . $row['COUNT(spillerid)'] . "</td>";
echo "<td>" . $maal . "</td>";
echo "<td>" . $assist . "</td>";
echo "<td>" . $gule . "</td>";
echo "<td>" . $rode . "</td>";
echo "</tr>";
}
echo "</table>";
?>
Hvis det ikke virker, så exporter din database og læg den her så jeg kan arbejde ud fra den
Indlæg senest redigeret d. 25.09.2008 15:39 af Bruger #14181