E
E
Evgeny Elizarov2018-04-09 18:56:51
PHP
Evgeny Elizarov, 2018-04-09 18:56:51

How to store and display a comparison table of product parameters?

There is a table, something like take.ms/kDG68 but much more
How to store, I more or less came up with:
3 tables
product_id|name
param_id|name
product_id|param_id|value With
this query I take all the data from the database

SELECT product.product_id, param.param_id.id, compare.value FROM param AS p
LEFT OUTER JOIN compare ON product.product_id = compare.product_id
LEFT JOIN product ON param.param_id = compare.param_id
ORDER BY param.sort, param.id, product.id

I get
1|1|Yes
1|2|No
...
but then I somehow fell into a stupor, how to assemble it correctly, so that I can conveniently display it? It is possible that I have already confused my head and the answer is somewhere on the surface and is extremely simple ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex-1917, 2018-04-12
@alex-1917

$tmp="SELECT NAME, ID, IBLOCK_SECTION_ID FROM b_iblock_section where ACTIVE = 'Y' and IBLOCK_ID = 9 ORDER BY IBLOCK_SECTION_ID, NAME";
$arr = mysql_query($tmp);
while ($item = mysql_fetch_array($arr)){
  echo $item['NAME'];
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question