[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] sql queries inside perl tag
At 06:50 PM 8/1/01, you wrote:
>Forgive me for sounding ignorant, plus I'm coming up on 13 hour work day
>here so there are mis-firing synapses in my head, but where would I place
>perl -W?
>
>I tried switching the line in /usr/local/interchange/bin/interchange
>to read #!/usr/local/bin/perl -W
I believe he meant as a stand-alone script, would it pass perl checks.
Looks like some syntax errors (missing quotes...).
To be a little less abusive to your database (especially if this code
is in a search results page) would be to use this structure:
(although really, the db really needs some re-organization :-)
Not tested, but the basic idea is there...
[query list=1 prefix=outer sql="SELECT sun
FROM products
WHERE code = '[item-code]'"]
[calc]
@sunarray = split(/,/, '[outer-param sun]'); # breaks with (') in
the field!
$out = '';
foreach $option (@sunarray) {
$out .= ($out) ? ",'$option'" : "'$option'";
}
return '';
[/calc]
[query list=1 prefix=inner sql="SELECT val
FROM sun WHERE code in ([calc]$out[/calc])'
ORDER BY val"]
[inner-param val]<br>
[/query]
[/query]
Good luck,
Kyle
_______________________________________________
interchange-users mailing list
interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users