>> 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> >> >Why not use selectrow_hashref()... then you get just the fields? > >Mathew
So how would my above example look different if I used selectrow_hashref()? My trys aren't working. ------------------------------------------------------------------------------ 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 _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users