Re: [Templates] DBI question about placeholders

[prev] [thread] [next] [Date index for 2004/12/13]

From: Michael Peters
Subject: Re: [Templates] DBI question about placeholders
Date: 18:03 on 13 Dec 2004
Robert wrote:
> Can I pass in a variable as the placeholder? I read in the DBI plugin docs 
> that you can do something like this:
> 
> [% query = DBI.prepare('SELECT * FROM users WHERE uid = ?') %]
> 
> [% FOREACH user = query.execute('sam') %]
>        ...
> [% END %]
> 
> What I would like to do is pass a variable to the query.execute statement. 
> If that is possible.

[% FOREACH user = query.execute($sam) %]

would work, assuming you have a variable visible to your template named 
$sam.

        -- 
        Michael Peters
Developer
Plus Three, LP


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] DBI question about placeholders
Michael Peters 18:03 on 13 Dec 2004

Re: [Templates] DBI question about placeholders
Andy Wardley 08:54 on 14 Dec 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52