【发布时间】:2011-01-10 20:28:21
【问题描述】:
我需要任何人的帮助,我会很感激的。
我已经做了 2 个 JOiN-s。事实上,我有 3 张桌子
- 艺术家姓名表 (m)
- 带有产品信息的表格,在本例中为图片地址 (p)
- 具有艺术家 ID 和产品 ID 的表。 (pmx)
这是 SELECT 语句:
SELECT
m.manufacturer_id ,
m.mf_name ,
p.product_id ,
p.product_full_image
FROM
jos_vm_product_mf_xref AS pmx
JOIN
jos_vm_manufacturer AS m ON m.manufacturer_id = pmx.manufacturer_id
JOIN
jos_vm_product AS p ON p.product_id = pmx.product_id
WHERE
m.mf_chars = 'm'
我想要达到的效果类似于 [http://www.ugallery.com/ArtistList.aspx?RC=1][1]
事实上我得到的只是:
- 名称1 - 产品1
- 名称1 - 产品2
- 名称2 - 产品1
- 名称1 - 产品3
我想要它,在 foreach (smth) { smth } 之后得到:
- 名称1 - prod1 prod2, prod3
- 名称2 - prod1 prod2
-
名称3....等
<ul> <?php foreach ($this->artistlist as $item) { ?> <li><a href="index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=<?php echo $item->manufacturer_id; ?>"><?php echo $item->mf_name; ?></a> <a href="index.php?page=shop.product_details&flypage=flypage.tpl&product_id=<?php echo $item->product_id; ?>&option=com_virtuemart"> <img src="components/com_virtuemart/shop_image/product/<?php echo $item->product_full_image; ?>" height="75px"> </a> </li> <?php } ?> </ul>
这是我现在正在使用的 PHP 代码...
所以请,请,请...。谁能帮助我?
这是一段代码
foreach ($this->artistlist as $picture) {
if(!isset($artists[$picture['manufacturer_id']])) { <---this is line 22
$artists[$picture['manufacturer_id']] = array(
'name'=>$picture['mf_name']
);
}
所以...错误:警告:在第 35 行的 D:\Server\xampp\htdocs\ta\components\com_artists\views\artists\tmpl\default.php 中为 foreach() 提供的参数无效
foreach($artist['pictures'] as $pictureId=>$pictureFullImage) {
还有另一个问题: 输出的 HTML 是这样的:
<ul>
<li>
<a href="/ta/index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=3">Giorgi Mihkeil</a>
**</li><li>** <--- and, can we get rid of this pieces? *<a href="/ta/index.php?option=com_virtuemart&page=shop.browse&manufacturer_id=$picture->artist_id"></a>* <-- what is this link? where does it come from?
<a href="/ta/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=1&option=com_virtuemart">
<img src="/ta/components/com_virtuemart/shop_image/product/Lonely_Boat_4cfa773e83874.jpg" height="75px">
</a> <a href="/ta/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=2&option=com_virtuemart">
<img src="/ta/components/com_virtuemart/shop_image/product/Naked_Couple_4cfbd12805f5b.jpg" height="75px">
</a> <a href="/ta/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=4&option=com_virtuemart">
<img src="/ta/components/com_virtuemart/shop_image/product/Lonely_Boat_4d246dbef30e1.jpg" height="75px">
</a></li></ul>
现在这个 html 就像:<ul><li>NAME </li><li> <img1><img2><img3> </li></ul>
我们可以像这样:<ul><li>NAME <img1><img2><img3> </li></ul> 吗?
【问题讨论】: