#!/usr/bin/perl use strict; use DBI; use Template; my $template = Template->new; my $DBH = get_dbh(); # connect somehow my $janedeo_id = 2; my $sth = $DBH->prepare('SELECT userid, FNAME, LNAME, title, age, country FROM msg as M JOIN users as SND ON SND.userid = M.msg_from WHERE M.msg_to = ? AND M.received iS NULL'); $sth->execute($janedeo_id); my $data = $sth->fetchall_arrayref({}); my $templ =<< "END_HTML";