I have 3 MySQL tables:
- produs(id, name, price)
- spec_laptop(id,id_produs -foreigkey(produs-id), brand)
- spec_telefon(id,id_produs -foreigkey(produs-id), brand)
and 2 pages:
- telefon.php (which will have a list of brands of cellphones)
-
laptop.php (which will have a list of brands of laptops)
I tried to make a query which displays names and prices from produs which:
- When I click a brand from telefon.php , display all cellphones names and prices who have that brand
- When I click a brand from laptop.php , display all laptops names and prices who have that brand
Example: (it doesn't work and I don't know why):
SELECT t1.*,t2.*,t3.* FROM produs as t1 join spec_laptop as t2 join spec_telefon as t3 WHERE(t1.id=t3.id_produs OR t1.id=t2.id_produs) AND t2.brand='Acer'