0

我有一个发送电子邮件的 perl test.pl 页面。电子邮件包含指向 html 页面 linkfromTest.html 的链接。

(Interchange 是 Interchange Development Group 提供的用 Perl 编写的基于 Web 的应用程序框架。主页: http: //www.icdevgroup.org/i/dev

但是我必须使用来自 test.pl '$ref->{'outofstock_prod'}' 的 sql 查询的结果在 linkfromTest.html 页面中需要运行 sql 查询。

 test.pl

$sql = "select OS.id,OS.name,OS.date,OS.customer_email,OS.product as outofstock_prod,OS.salesperson_email,OS.salesperson
    from outofstock_sku as OS 
    where mail_sent='0'
    order by OS.id";

$ref->{'outofstock_prod'}
......
......
print MAIL "More items potentially matched.\n\n";
print MAIL "Click here to view more items : http://qqq.qqqq.com/linkfromTest.html\n\n";
.....




linkfromTest.html


    [query list=1 sql="select P.sku,P.manufacturer,P.category,P.scat,P.description,P.imgid
                from 
                products AS P LEFT JOIN inventory AS I 
                ON (I.sku = P.sku AND I.status = 'A') 
                WHERE P.manufacturer LIKE  '$ref->{'outofstock_prod'}''
                LIMIT 0,4;"]    

提前致谢

4

1 回答 1

0

您可以尝试在暂存空间中设置一个临时变量。

在 test.pl 中:

$Tag->tmp('outofstock_prod');  # remove this when done
$Scratch->{outofstock_prod} = $ref->{outofstock_prod};

然后,在 linkFromTest.html 中:

    [query list=1 sql="select P.sku,P.manufacturer,P.category,P.scat,P.description,P.imgid
            from 
            products AS P LEFT JOIN inventory AS I 
            ON (I.sku = P.sku AND I.status = 'A') 
            WHERE P.manufacturer LIKE  '[scratch outofstock_prod]'
            LIMIT 0,4;"]

(我不确定$ref它是什么,或者它的outofstock_prod字段包含什么。如果它不是一个字符串,你可能必须先用它构建一个字符串,然后再将它插入$Scratch。)

于 2012-11-17T05:25:36.040 回答