katıldığı başka bir tablo, çok sayıda kayıt olduğunda bir kayıt vardır tablo kayıtları görüntülemek için nasıl

0 Cevap php

Bu site, e-ticaret sitesi gibi ve ben üzerinde şaşırıp iki tablo var.

tbl_products
---------------
phash
product
price
desc
maxcount


tbl_product_images
-------------------
phash
thumb
large

tbl_products stores the products description tbl_product_images stores the path of the thumb and large image of eac product.

phash ürünlerin adının bir md5 onun ne birlikte bir şeyler eşleşen zaman ben doğrusu id veya ürün adı daha kullanın.

what i'm having throuble with is say tbl_products has one record for a product and tbl_product_images in relation to that product has 5 rows for its images.

nasıl ben sorguyu çalıştırmak istiyorsunuz?

$sql = "select
    tbl_products.phash
    tbl_products.product
    tbl_products.price
    tbl_products.desc
    tbl_products.maxcount
    tbl_product_images.phash
    tbl_product_images.thumb
    tbl_product_images.large
    from tbl_products
    inner join tbl_product_images
    on tbl_products.phash = tbl_products_images.phash";

Bu tbl_product_images beri kayıtları 5 satır gösterecektir 5 kayıtları vardır.

i çıkış yolu benim geleneksel yoludur

$query = $db->query("$sql");
while($row = $db->fetch($query))
{
....

}

Eğer bana bildirin lütfen anlatmaya çalışıyorum ne daha fazla açıklama gerekirse ben, ben bunu yapmak için gidiyorum nasıl gerçekten emin değilim. teşekkürler

0 Cevap