我有这样的阵列:如何生成使用分隔列&值的阵列的查询
$filter=['color*black','color*blue','color*red','paint*apex','paint*dalton'];
每个值在$filter
具有由*
分离的两个子串。第一个子字符串表示数据库表格列,第二个表示该列的所需值。
我products
表看起来像这样:
id name color paint
1 p1 black compo
2 p2 red dalton
3 p3 pink apex
4 p4 blue apex
5 p5 cream compo
使用$filter
,我需要搜索products
表并用的apex
或dalton
一个paint
价值和black
一个color
值返回所有行,blue
,或red
。
所需的输出是一个MySQL查询,将只返回这些行:
id name color paint
2 p2 red dalton
4 p4 blue apex
你可以请运行这与给定的表结构和条目。 –
@abilasher我检查了[你的问题](https://stackoverflow.com/questions/44602309/making-a-proper-image-capture-of-screen-using-jquery),但不幸的是,不能帮助你用它.. –
好的朋友。 ... –