[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] question about [if] tag
Quoting Rene Hertell (rene@hertell.com):
>
> > I'm trying to do an [if] comparision inside a query but I guess
> > my [if] tags
> > are wrong.
> > There's not much docs about [if-sql] tags and the ones that I found on the
> > interchange lists didn't work either. Here's my code below.
> >
> > <select name="issue_agency" >
> > [query sql="SELECT * FROM agency" type=list]
> > <option value="[sql-param code]"
> > [if term="sql-param code" op="eq" compare="/[value issue_agency]/"
> > ] selected [/if]>
> > [sql-param issue_agency]
> > </option>
> > [/query]
> > </select>
>
> I guess that you dont have to escape the brackets in the comparison..
>
Interchange recognizes this is a frequent need and provides
a standard "option" param to set the current value from the $Values
hash.
<select name="issue_agency">
[query sql="SELECT code,issue_agency FROM agency" type=list option=issue_agency]
<option value="[sql-param code]"> [sql-param issue_agency]</option>
[/query]
</select>
That is all you need.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
How far can you open your mind before your brains fall out?