in reply to using CGI, DBI and HTML::Template (a mini tutorial with example code)
selectall_hashref() only works in a limited number of versions of DBI (maybe 1.15 through 1.19). For the newest versions, 1.20 and greater I believe, you can get the same functionality that you are looking for like this:
selectall_arrayref($sql,{ Slice => {} });
selectall_hashref does something different in the newest versions and your old code will break.
Here's another way to process your DB output as well:
my $rows = $DBH->selectall_arrayref($sql,{ Slice=>{} }); for (@$rows) { # add key/value for Pi to every row. $_->{pi} = 3.14; }
For even lazier form re-filling, look into adding HTML::FillInForm into the mix. Then you don't even have to add the <tmpl> tags into your forms in many cases. I use this in conjuction with HTML::Template. There is as outdated tutorial on using these here. It's outdated because HTML::FormValidator has been superceded by Data::FormValidator.
-mark
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: using CGI, DBI and HTML::Template (a mini tutorial with example code)
by gav^ (Curate) on Feb 12, 2002 at 16:47 UTC | |
by blue_dragon99uk (Initiate) on Oct 15, 2002 at 03:12 UTC | |
by Anonymous Monk on Feb 08, 2004 at 09:08 UTC |
In Section
Meditations