[ic] Accessing perl query results using interchange [sql-param] tag

Duane Hinkley duane at DownHomeWebDesign.com
Thu Mar 18 07:43:31 EST 2004


----- Original Message ----- 
From: "John1" <list_subscriber at yahoo.co.uk>
To: <interchange-users at icdevgroup.org>
Sent: Saturday, March 13, 2004 8:10 AM
Subject: [ic] Accessing perl query results using interchange [sql-param] tag


> Is there a way for me to access the results of a query made within
> [perl][/perl] tags, using the [sql-param] tag or similar?
>
> i.e.
>
> [perl]
> $sql = "SELECT description, thumb, image, price, sale_price from products
> WHERE sku='$Scratch->{fly_code}'";
> $result_array = $Tag->query({sql=>$sql});
> [/perl]
> ...
> [sql-param description]
> ...
>
> Thanks,
>
> John
>

John,

Instead of doing the query inside the perl tags, this is what I do:

        [query sql="

      SELECT   orderline.sku, count(orderline.sku) as no_ordered
   FROM     orderline,products
   WHERE    orderline.sku = products.sku
     AND    products.category = '[perl] return $something; [/perl]'
   GROUP BY orderline.sku
   ORDER BY no_ordered desc
   LIMIT 3"

                        type=list
        ]
[list]
[sql-param sku]<br>
[/list]
[/query]



Sincerely,

Duane Hinkley

Down Home Web Design, Inc.
9494 W. Fairview Ave., Suite C
Boise, Idaho 83704

(208) 424-0572
Fax(208) 587-0738

duane at dhwd.com
www.downhomewebdesign.com




More information about the interchange-users mailing list