[Catalyst] Variable in where clause
    Danijel Milicevic 
    Danijel.Milicevic at rawmode.org
       
    Wed Sep 14 08:39:09 CEST 2005
    
    
  
Hi Dan,
Am Dienstag, den 13.09.2005, 23:51 -0400 schrieb Danh Nguyen:
> Hi,
>  
> I wantto put a variable in the WHERE clause in Template. something
> like this:
>  
> [% USE DBI('dbi:SQLite:C:\minimojo.db ') %]
>  
>  [% SET myid= 2 %]
>     
>     [% FOREACH user = DBI.query('SELECT * FROM user WHERE id= myid')
> %]
>  
>     <table border="1" width="54%">
>       <tr>
>         <td width="15%">User ID</td>
>         <td width="85%">[% user.id %]<td>
>       </tr>
>       <    </table>
>     [% END %]
>  
> I have tried all possible syntax, but cannot get it. Anyone could help
> me out?
Please DO NOT do this to us - you make little jesus cry. Making Database
queries in the view while using a MVC Framework is just so wrong. Please
read up on the MVC design pattern and also take a look at the example
applications in Catalyst/examples (you can find it in trunk).
A truly scared,
Danijel "gabb" Milicevic
    
    
More information about the Catalyst
mailing list