jagdish eashwar wrote:
> use DBI;
> $dbh = DBI->connect('dbi:mysql:tt2','user_name','user_password');
> $sth = $dbh->prepare('SELECT * FROM salary_data');
> $sth->execute();
> while ($hash_ref = $sth->fetchrow_hashref) {
> foreach $key(keys %$hash_ref) {
> print "$key = $hash_ref->{$key}\n";
> }
The TT equivalent would be something like this:
[% USE DBI('dbi:mysql:tt2','user_name','user_password');
FOREACH record IN DBI.query('SELECT * from salary_data');
FOREACH key IN record.keys;
key; ' = '; record.$key;
END;
END;
%]
HTH
A
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates