About MySQL Tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have two tables that share product codes to relate data.
One table is called IMAGE, and another one is called the PRODUCT.
There are more than one image for every product, for example product code 1122 will have 3 images and 4938 will have 5 images within the IMAGE table. Since all my product information is stored in PRODUCT table except for the image file names (e.g. 1122_1.jpg, 1122_2.jpg or 4938_1.gif), I have to build the following query: SELECT * FROM PRODUCT, IMAGE WHERE PRODUCT.productcode = IMAGE.productcode. However, this causes a little problem. When I print out all the product information with its images, more than one copy of a product is printed out (because of multiple images for each product). I'm still looking for a way to build a query string so that I could have only one image displayed per product (so that a user can click on the product to view more images).

Do you know how this problem can be best approached?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux