Headhunter
|
| Posted: 06/15/2003, 11:54 PM |
|
PHP4 + MySQL + CCS2.1
In my project I have a detail page of a car (to be sold). In this detail page I have numerous of (if apply) options for that car. Now, what I want to do is let these items show not in a Tabular layout grid or something, but simple in plain text seperated by a comma in a table cell.
Thus not:
Airco
Leather interior
Radio-cd
But:
Airco, Leather interior, Radio-cd
Maybe it's possible to get the output right out the db with the sql query?
Thx for helping me (again)
|
|
|
 |
RonB
|
| Posted: 06/16/2003, 12:57 AM |
|
You didn't state if the properties are stored each in their own field in a table. If they are, all you have to do is add labels in the same cell seperated by comma's:
---------- --------------------------
Model |{label1},{label2},{label3}|
-------------------------------------
This would ofcourse create a problem if some labels are empty for some car models (a,b,,,c). You could also use the set tag action. You create an array with the help of a query and add the data in the before show row event.
Ron
|
|
|
 |
Headhunter
|
| Posted: 06/16/2003, 5:35 AM |
|
All my car options are stored in a table called "car_options" which is linked to a lookup table called "tags", which is linked to another table called "tags_lbl" with 3 languages for all the labels.
Cars are stored in "products" table
"car_options" table : id, prod_id, tag_id
"tags" table: tag_id, tag_code, tag_description
"tags_lbl" table: tll_id, tll_tag_id, tll_lang_id, tll_label
SQL:
SELECT car_options.*, tll_label
FROM (tags INNER JOIN car_options ON tags.tag_id = car_options.tag_id) INNER JOIN tags_lbl ON tags_lbl.tll_tag_id = tags.tag_id
WHERE prod_id = {car_id} AND tll_lang_id = {lang}
Hope this helps clarify my db setup
You can view the page at: http://headhunter.dnsalias.org:14080/geeco/index.php
-> used cars -> pick one -> 2nd grid (options)
Thx
|
|
|
 |
|