Mailinglisten-Archive |
hallo,
ich habe drei tabellen in dennen ich meine bild - informationen
speichere.
CREATE TABLE products (
products_id int(5) NOT NULL auto_increment,
products_quantity int(4) DEFAULT '0' NOT NULL,
products_model varchar(12),
products_image varchar(64),
products_info_image varchar(64),
products_big_image varchar(64),
products_price decimal(8,2) DEFAULT '0.00' NOT NULL,
products_date_added datetime,
products_last_modified datetime,
products_date_available datetime,
PRIMARY KEY (products_id)
);
CREATE TABLE products_description (
products_id int(5) NOT NULL auto_increment,
language_id int(5) DEFAULT '1' NOT NULL,
products_name varchar(64) NOT NULL,
products_description text,
products_viewed int(5) DEFAULT '0',
PRIMARY KEY (products_id, language_id),
KEY products_name (products_name)
);
CREATE TABLE products_tip (
tip_id int(11) NOT NULL auto_increment,
products_id int(5) DEFAULT '0' NOT NULL,
products_tip_id int(5) DEFAULT '0' NOT NULL,
PRIMARY KEY (tip_id, products_id)
);
wenn ich ein bild anzeige möchte ich nun zu dem bild
weitere bild empfehlungen anzeigen.
in der products_tip schreibe ich daher die
zu der products_id passenden id nummern rein.
#
# Daten für Tabelle 'products_tip'
#
INSERT INTO products_tip VALUES ( '1', '44', '78');
INSERT INTO products_tip VALUES ( '2', '78', '44');
INSERT INTO products_tip VALUES ( '3', '44', '36');
INSERT INTO products_tip VALUES ( '4', '76', '75');
INSERT INTO products_tip VALUES ( '5', '75', '76');
INSERT INTO products_tip VALUES ( '6', '83', '71');
INSERT INTO products_tip VALUES ( '7', '71', '83');
d.h wird dem besucher das bild [ product_id = 44 ]
angezeigt... sollen die bilder mit der id 78 und 36
dem besucher als tipp angezeigt werden.
hier meine abfrage
<?php
$products_tip_query = tep_db_query("select products_tip_id from " . TABLE_PRODUCTS_TIP . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' order by tip_id ";
if($tip = tep_db_query($products_tip_query)){
while($tipps = tep_db_fetch_array($tip)){
$product_tip = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image,
p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $tipps['products_tip_id'] . "' and pd.products_id = '" .
$tipps['products_tip_id'] . "' and pd.language_id = '" . $languages_id . "'");
$product_tip_values = tep_db_fetch_array($product_tip);
echo '<td align="center" class="main">... die ausgabe ... </td>' . "\n";
}
}
?>
kann ich diese select abfragen nicht in einer zusammenfassen?
und wenn ja... wie?
für jeden hinweis dankbar
ralf
--
http://www.r23.de/galerie/
mailto:info_(at)_r23.de
---
Infos zur Mailingliste, zur Teilnahme und zum An- und Abmelden unter
-->> http://www.4t2.com/mysql
php::bar PHP Wiki - Listenarchive