Guten Morgen,
es sollen die jeweils aktuellsten Produkte aus einer mySQL DB geholt werden. Mit Bild! Der holt aber zig mal dasselbe Produkt. :(
QUERY:
$res =& $db->query("
SELECT p.name, pic.picture, pi.d_produktbeschreibung
FROM products AS p, productinfo AS pi
LEFT JOIN lnk_product_pic AS lpp ON (p.pid = lpp.pid)
LEFT JOIN picture AS pic ON (lpp.id_picture = pic.id_pic)
WHERE (p.since = '".date('Y')."') OR (p.since = '".(date('Y')-1)."')
AND (p.pid = pi.pid)
ORDER BY p.since DESC");
Tabellenstruktur:
Ach du wolltest die Tabellenstruktur haben ?
Tabelle products
----------------------------------
pid | category | name |since
Tabelle productinfo
----------------------------------
lang | pid | d_produktbeschreibung
Tabelle picture
----------------------------------
id_pic | picture
Tabelle lnk_product_pic
----------------------------------
pid |id_picture