Der aktuelle Code:
Code:
$_query = "SELECT hellhaus_produkte.hellhaus_produkte_id as id, hellhaus_produkte.name as name, hellhaus_produkte.hersteller as hersteller, hellhaus_produkte.artikelnummer as artikelnummer, REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE(hellhaus_produkte.name, 'Ä', 'A'), 'Ö', 'O'), 'Ü', 'U'), 'ä', 'a'), 'ö', 'o'), 'ü','u'), 'ß', 's') as sort, hellhaus_produkte_aktiv.hellhaus_produkte_id as aktiv ";
$_query .= "FROM hellhaus_produkte ";
$_query .= "LEFT JOIN hellhaus_produkte_aktiv ON hellhaus_produkte_aktiv.hellhaus_produkte_id = hellhaus_produkte.hellhaus_produkte_id ";
$_query .= "WHERE hellhaus_produkte.archiv = '0' ";
Die Datenbankstruktur
hellhaus_produkte
Hier liegt der eigentliche Content, der später per mysql_result abgefragt wird.
Wichtig für mein Abfrage ist nur die Spalte:
hellhaus_produkte_id
hellhaus_produkte_bereiche_join
Und in dieser Tabelle werden Bereich und Produkt zugeordnet
Die Spalten heißen:
hellhaus_produkte_id
hellhaus_bereiche_id
Das Ziel
Ich möchte als Resultat nur noch die Zeilen aus der "hellhaus_produkte" Tabelle auslesen, welche einem bestimmten Bereich zugeordnet sind.
Der (Fehl)Versuch
Versuchsweise habe ich einfach an das
Code:
"WHERE hellhaus_produkte.archiv = '0'
ein
Code:
AND hellhaus_produkte_bereiche_join.hellhaus_produkte_id = '$Kategorie'"
angehängt.
SQL meldet allerdings, daß die Tabelle "hellhaus_produkte_bereiche_join" unbekannt ist.
Kein Wunder, schließlich taucht sie ja auch sonst nirgendwo auf.
Die Vermutung
Ich vermute also, daß ich die Tabelle "hellhaus_produkte_bereiche_join" noch im "FROM" teil mit einem JOIN einbauen muss.
Die Frage an euch
Ist, wie mache ich das.
Wäre klasse, wenn ihr eine Lösung für mich habt.
Sollte es schon vom Prinzip nicht gehen, wartet wohl noch etwas mehr Arbeit auf mich...