habt mir ja schon mal geholfen
ich habe Artikel bzw. Produkte -> Tabelle tx_item_produkt
ich habe Kategorien -> Tabelle tx_item_Cat
ind eine Hilfstabelle -> tx_item_produkt_category_mm
über die Variable $auswahl möchte ich später stuern welche Kategorien angezeigt werden sollen.
in tx_item_produkt_category_mm wird jedes Artikel-Kategorie-Verhältnis in eine Zeile geschrieben
mein Code sieht so aus:
Code: Alles auswählen
$sql = "SELECT *
FROM tx_item_produkt
INNER JOIN tx_item_produkt_category_mm ac ON ( ac.uid_local = tx_item_produkt.uid )
INNER JOIN tx_item_Cat c ON ( c.uid = ac.uid_foreign )";
if ($auswahl == '') {
}else {
$sql .="WHERE ac.uid_foreign IN ($auswahl)";
}
$abfrage = mysqli_query($verbindung, $sql);
while($articel = mysqli_fetch_assoc($abfrage)){
echo "<tr>";
echo "<td>$articel[uid] </td>";
echo "<td>$articel[title] </td>";
echo "<td>$articel[text]</td>";
echo "<td>$articel[category]</td>";
echo "</tr>";
}
echo "</table>";
mysqli_free_result();