Die Ausgabe erfolgt ungewollt doppelt. Ich habe zwei Tabellen, einmal eine mit Gruppeninfos (id, name, thema etc.) und eine mit den gruppenmitgliedern (nutzerid und id der gruppe, in der er Mitglied ist).
Jetzt meine Abfrage:
Das Problem: es wird so ausgegeben:
Link Gruppe a
Link Gruppe b
Link Gruppe a
Link Gruppe b
Also wird es wohl doppelt ausgeführt. Ich finde nur bloß keinen Fehler. Richtig soll es so sein:
Link Gruppe a
Link Gruppe b
etc.
Jetzt meine Abfrage:
PHP-Code:
$query = "SELECT DISTINCT groupids.groupid, grouplist.name FROM grouplist, groupids WHERE groupids.userid = '$userid'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$groupid = $row["groupid"];
$name = $row["name"];
echo "<a style='color:#003399' href='groups.php?id=$groupid'>$name</a>";
}
Link Gruppe a
Link Gruppe b
Link Gruppe a
Link Gruppe b
Also wird es wohl doppelt ausgeführt. Ich finde nur bloß keinen Fehler. Richtig soll es so sein:
Link Gruppe a
Link Gruppe b
etc.
Kommentar