Jump to content
Nikpro

blockviewed -不到阵列中重复(一类或品牌)的值。

Recommended Posts

你好
我想创建一个美味的提议给人类。
 
我半路上。
我只离开了没有表现出重复值。
 
此刻,我已经展示了产品的意见的基础上。
1.分类
2.制造商
 
但现在,他们都反复
 
我说行266
 
$ Obj-> id_manufacturer = (int) ($ productsImagesArray [$ productViewed] [ 'id_manufacturer']);
 
$ Obj-> id_category_default = (int) ($ productsImagesArray [$ productViewed] [ 'id_category_default']);
 

 

 

 

并呼吁基地

SELECT MAX(image_shop.id_image) id_image, p.id_product, il.legend, product_shop.active, pl.name,

 p.id_manufacturer,
p.id_category_default,
 
 
m.name AS manufacturer_name,

 

 
in  tpl 
 
{$link->getCategoryLink($viewedProduct->id_category_default)}

 

 

 
我怎样才能消除值的重复?
post-91213-0-20563900-1467268804_thumb.jpg
 
  1. $c=array();
  2. foreach($a as $b)
  3. {
  4.     if(!in_array($b,$c))
  5.     {
  6.      $c[]=$b;
  7.      echo $b;
  8.     }
  9. }
  10.  
我知道,有一种比较方式。但花后2天我没能找到一个解决方案(((
 
 
 
if (is_array($obj->id_manufacturer) && count($obj->id_manufacturer))
{
foreach ($obj->id_manufacturer as $key => $obj->id_manufacturer)
{
if ($productsImagesArray[$productViewed]['id_manufacturer'] == $obj->id_manufacturer)
{
unset($obj->id_manufacturers[$key]);
 
}
}
} ;
 
 
 
 

 

Share this post


Link to post
Share on other sites

你看看你的数据库查询语句结果,后面加一个 group by 就可以吧,

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More