搜索结果后,按用户ID和数据ID显示一个表上的多个数据

时间:2016-02-23 12:42:02

标签: php sql

我创建了一个具有多个选择值的搜索面板,搜索面板正常工作,但问题是: - 我的数据库表:产品

sno |  productid | shopname
-----------------------------
1   |     one    | oneshop
-----------------------------
2   |     One    | twoshop
-----------------------------
3   |     Two    | oneshop
-----------------------------
4   |     Three  | oneshop
-----------------------------
5   |     Two    | twoshop

用户产品在搜索面板中选择多个。

现在在搜索面板中搜索用户

用户选择产品(一,二,theee)

查询是在搜索后显示所有结果

   SELECT * from product where productid = '$productselect' AND shopname = '$shopfoundproduct'

结果发现5

  Result one
     productid    |    shopname
     ----------------------------
          one     |    oneshop

 Result two
     productid    |    shopname
     ----------------------------
          one     |    twoshop

 Result three
     productid    |    shopname
     ----------------------------
          two     |    oneshop

 Result four
     productid    |    shopname
     ----------------------------
          two     |    twoshop

Result five
     productid    |    shopname
     ----------------------------
          three   |    oneshop

我希望结果是:

结果发现2

 result one 

 productid   |    shopname
 --------------------------
 one         |    oneshop
 --------------------------
 two         |    oneshop
 --------------------------
 three       |    oneshop 


 result one 

 productid   |    shopname
 --------------------------
 one         |    twoshop
 --------------------------
 two         |    twoshop

谢谢......

0 个答案:

没有答案