noch ne frage:
kann es sein, dass man while-schleifen nicht verschachteln darf?
aufgrund eines schlechten tabellenlayouts war ich gezwungen ein script so zu lösen...
mal kurz beschreiben:
tabelle teams(mannschaften sind darin gespeichert)
->teamname
->ID
->gruppe
->spiele
->Punkte
->Tore
->Gegentore
->Bezirk
also und ich muss ein tabellensystem machen. das wollt ich so lösen:
[php:1:f7efd07509]<?php
while ($gruppe = mysql_fetch_array(@mysql_query($sql))) {
$Gruppenname = $gruppe['Gruppenname'];
echo "
<p align=\"center\" class=\"para\">".$Gruppenname."</p>
<table width=\"600px\" align=\"center\" cellspacing=\"0px\" cellpadding=\"0px\" class=\"datenblatt\">
<tr>
<th width=\"300px\" align=\"left\">
Team</p></td> \n
<th width=\"50px\" align=\"center\">
Gruppe</p></td> \n
<th width=\"50px\" align=\"center\">
Spiele</p></td> \n
<th width=\"50px\" align=\"center\">
Tore</p></td> \n
<th width=\"100px\" align=\"center\">
Gegentore</p></td> \n
<th width=\"50px\" align=\"center\">
Punkte</p></td> \n
</tr> \n";
$sql2 = "SELECT TeamName, Tore, GTore, PKT, Gruppe, Spiele WHERE Gruppe='".$Gruppenname."'";
while ($rows = mysql_fetch_array(@mysql_query($sql2))) {
$teamName = $rows['TeamName'];
$Tore = $rows['Tore'];
$GTore = $rows['GTore'];
$PKT = $rows['PKT'];
$gruppe = $rows['Gruppe'];
$spiele = $rows['Spiele'];
echo "
<tr> \n
<td width=\"300px\" align=\"left\">
$teamName</p></td> \n
<td width=\"50px\" align=\"center\">
$gruppe</p></td> \n
<td width=\"50px\" align=\"center\">
$spiele</p></td> \n
<td width=\"50px\" align=\"center\">
$Tore</p></td> \n
<td width=\"100px\" align=\"center\">
$GTore</p></td> \n
<td width=\"50px\" align=\"center\">
$PKT</p></td> \n
</tr> \n"; }
echo "</table> \n";
}
?>[/php:1:f7efd07509]
der ober teil is vielleicht auch interessant, also hier das ganze:
[php:1:f7efd07509]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bezirke</title>
<meta name="Author" content="L2Agentur GmbH. -Philipp Wrann" />
<meta name="Owner" content="L2Agentur GmbH" />
<meta name="Description" content="Der Interspar Juniorcup 2006 ist ein Fussballturnier fuer die kleinen Kicker Österreichs." />
<meta name="Keywords" content="Interspar Juniorcup, Juniorcup, Fussball, nachwuchsfussball, fussballturnier" />
<meta name="language" content="Deutsch" />
<link href="css/locs.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$loc = $_GET['loc'];
echo "<h1>$loc</h1>";
include 'connect.inc.php';
//LocID herausfinden
$sql = "SELECT ID FROM locs WHERE Bezirk = '".$loc."' LIMIT 1";
$res = mysql_fetch_array(@mysql_query($sql));
$locID = $res['ID'];
//Anzahl der Gruppen herausfinden
$sql = "SELECT COUNT(DISTINCT Gruppe) AS anzahlGruppen FROM teams WHERE locID = '".$locID."'";
$res = mysql_fetch_array(@mysql_query($sql));
$anzahlGruppen = $res['anzahlGruppen'];
//Gruppenwerte herausfinden
$sql = "SELECT DISTINCT Gruppe AS Gruppenname FROM teams WHERE locID = '".$locID."'";
while ($gruppe = mysql_fetch_array(@mysql_query($sql))) {
$Gruppenname = $gruppe['Gruppenname'];
echo "
<p align=\"center\" class=\"para\">".$Gruppenname."</p>
<table width=\"600px\" align=\"center\" cellspacing=\"0px\" cellpadding=\"0px\" class=\"datenblatt\">
<tr>
<th width=\"300px\" align=\"left\">
Team</p></td> \n
<th width=\"50px\" align=\"center\">
Gruppe</p></td> \n
<th width=\"50px\" align=\"center\">
Spiele</p></td> \n
<th width=\"50px\" align=\"center\">
Tore</p></td> \n
<th width=\"100px\" align=\"center\">
Gegentore</p></td> \n
<th width=\"50px\" align=\"center\">
Punkte</p></td> \n
</tr> \n";
$sql2 = "SELECT TeamName, Tore, GTore, PKT, Gruppe, Spiele WHERE Gruppe='".$Gruppenname."'";
while ($rows = mysql_fetch_array(@mysql_query($sql2))) {
$teamName = $rows['TeamName'];
$Tore = $rows['Tore'];
$GTore = $rows['GTore'];
$PKT = $rows['PKT'];
$gruppe = $rows['Gruppe'];
$spiele = $rows['Spiele'];
echo "
<tr> \n
<td width=\"300px\" align=\"left\">
$teamName</p></td> \n
<td width=\"50px\" align=\"center\">
$gruppe</p></td> \n
<td width=\"50px\" align=\"center\">
$spiele</p></td> \n
<td width=\"50px\" align=\"center\">
$Tore</p></td> \n
<td width=\"100px\" align=\"center\">
$GTore</p></td> \n
<td width=\"50px\" align=\"center\">
$PKT</p></td> \n
</tr> \n"; }
echo "</table> \n";
}
?>
</body>
</html>
[/php:1:f7efd07509]
btw: "anzahl der gruppen herausfinden" is nun doch umsonst
edit: einen sql-fehler hab ich schon gefunden und ausgebessert(hab FROM vergessen

) aber mir werden unbegrenzt viele tabellen berechnet...
edit2: das problem liegt definitiv in der ersten whileschleife..