我正在创建一个规范系统,但是我的请求和结果存在问题。信息重复。
如果您需要更多信息,我将完成文档。
谢谢。
我想在特定产品中获得的结果,像这样的表:
Connections {
target: model
onDataChanged: {
currentIndex = topLeft.row() + 1;
}
}
我得到的结果是:
Auto (categories)
Peugeot ===> 208 (sub categories)
Color ===> black
Material
Plastic ===> Yes
Cuir ===> Yes
我有2个请求:
此请求允许显示类别:汽车,材料
Auto
Peugeot ===> 208
Renault ===> 208 ==> no good value. it must not appear not included
Color ===> black
Color ===> black ==> no good value. it must not appear not included
Materials
Plastic ===> Yes
Cuir ===> Yes
$QSpecification = $this->db->prepare('select ag.specification_group_id,
agd.name,
pa.products_id
from :table_products_specification pa,
:table_specification a,
:table_products_specification_group ag,
:table_products_specification_group_description agd
where pa.products_id = :products_id
and agd.language_id = :language_id
and pa.customers_group_id = :customers_group_id
and pa.specification_group_id = a.specification_group_id
and a.specification_group_id = ag.specification_group_id
and ag.specification_group_id = agd.specification_group_id
and pa.status = 1
group by ag.specification_group_id
order by ag.sort_order,
agd.name
');
$QSpecification->bindInt(':products_id', $products_id);
$QSpecification->bindInt(':language_id', $this->lang->getId());
$QSpecification->bindInt(':customers_group_id', $this->customer->getCustomersGroupID());
$QSpecification->execute();
$specification = $QSpecification->fetchAll();
==>显示数组下的所有表
我创建了一个循环
fetchAll
在此循环中,我插入了所有数据结果
while($ QproductsSpecification-> fetch()){ if($ product_specification_group ['specification_group_id'] == $ QproductsSpecification-> valueInt('specification_group_id')){
foreach ($specification as $product_specification_group) {
$product_specification_data = [];
$QproductsSpecification = $this->db->prepare('select pa.specification_group_id,
a.specification_id,
pa.id,
ad.name,
pad.text
from :table_products_specification_description pad,
:table_products_specification pa,
:table_specification a,
:table_specification_description ad
where pa.products_id = :products_id
and a.specification_group_id = :specification_group_id
and a.specification_id = ad.specification_id
and pa.specification_group_id = a.specification_group_id
and ad.language_id = :language_id
and pad.language_id = :language_id
and pa.id = pad.id
and (pa.customers_group_id = :customers_group_id or pa.customers_group_id = 99)
and pa.status = 1
order by pa.sort_order,
ad.name
');
$QproductsSpecification->bindInt(':specification_group_id', $product_specification_group['specification_group_id']);
$QproductsSpecification->bindInt(':language_id', $this->lang->getId());
$QproductsSpecification->bindInt(':products_id', $products_id);
$QproductsSpecification->bindInt(':customers_group_id', $this->customer->getCustomersGroupID());
$QproductsSpecification->execute();