Load & Display 1 Row From DBI - Best Pract ice?
[email protected] Mon, 16 Mar 2009 19:20:42 -0700
| Newsgroups | gmane.comp.lang.perl.modules.html-template |
|---|---|
| Message-ID | <20090316192042.292eb6c930850de810cf35869bff7bc4.6077acf3f9.wbe@email.secureserver.net> |
I'm using HTML::Template from CGI::Application. My template is getting
data via a SQL query where exactly one row
retrieved, and it is displayed using <TMPL_LOOP>.
What is the proper way set & display values returned from DBI when only
one row is printed? I think the method described below may have a
better alternative.
Currently showing all records using a loop:
1. $template->param(
2. RESULTS => $self->dbh->selectall_arrayref('
3. SELECT age, day FROM table WHERE id = ?',
4. { Slice => {} },
5. $self->session->param('id') )
6. );
Template:
1. <TMPL_LOOP NAME="RESULTS">
2. <TMPL_VAR NAME="age"><TMPL_VAR NAME="day">
3. </TMPL_LOOP>
-Thanks
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com