[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] arbitrary database display
> On Fri, 22 Nov 2002 12:26:37 -0600 (CST)
> "Alex Lofaso (Planetanime.com)" <alex@planetanime.com> wrote:
>
>> Hello list!
>>
>> I've been trying to display the data from a arbitrary database table
>> in my fly page. For each sku from the products table there is a
>> number of records in my product_detail_parameters table. For example
>> for sku xyz there could be 3 rows:
>> sku id parameter value
>> xyz 1 p1 v1
>> xyz 2 p2 v2
>>
>> etc...
>>
>> here is the code i am using to display these records:
>>
>> [if-item-data products_detail_parameters sku]
>>
>> <table width="100%" cellspacing="0" cellpadding="5">
>>
>> [query sql="SELECT parameter, value FROM
>> product_detail_parameters where sku = [item-code] ORDER BY id"
>> type=list
>> list=1
>> ]
>> [list]
>> <tr>
>> <td>
>> <li><b>[sql-param parameter]: </b>
>> [sql-param value]</li>
>>
>> </td>
>> </tr>
>> [/list]
>> [/query]
>>
>> </table>
>> [/if-item-data]
>>
>>
>> Despite the fact that there is data in the table, I cannot seem to get
>> any results to display. I've also tried using the loop search method
>> to no avail. Any help would be great!
>
> You need to quote [item-code], e.g. '[item-code]'. Otherwise your SQL
> syntax is invalid given that the sku contains letters.
>
> Bye
> Racke
> _______________________________________________
I tried quoting the [item-code] by still no luck... I obviously must be
doing something else wrong. However I did try using [data
table=products_detail_parameters col=parameter key=[item-code]] just to
make sure it would return 1 item from the database table, and that works.
Puzzling.
Thanks
Alex