jarvis has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, can anyone help??... Please!!
I'm new to all this and i am trying to output data from a search query on mySQL to a loop variable using the loop function in HTML::Template ( <TMPL_LOOP NAME=""> <TMPL_VAR NAME=""> </TMPL_LOOP>) I understand that i have to return an array of hashes to the HTML::Template module, but i cant seem to successfully convert the output from mySQL to this array of hashes. I realise that i am missing something obvious, but i can't get my head around it. My code is something like this...
into an array of hashes
so that this bit (below)will output
it properly???
I'm new to all this and i am trying to output data from a search query on mySQL to a loop variable using the loop function in HTML::Template ( <TMPL_LOOP NAME=""> <TMPL_VAR NAME=""> </TMPL_LOOP>) I understand that i have to return an array of hashes to the HTML::Template module, but i cant seem to successfully convert the output from mySQL to this array of hashes. I realise that i am missing something obvious, but i can't get my head around it. My code is something like this...
how do i turn this bit (above - @vidinfo)##necessary stuff, use CGI etc... use constant TMPL_FILE => "C:/Xitami/cgi-bin6/templates/mytemplate.t +mpl"; my $tmpl = new HTML::Template( filename => TMPL_FILE, no_includes => 1 ); ##some other bits, then $dbh=DBI->connect($datasource,$user,$pass,{AutoCommit=> 1}) or die " +Can't Connect"; $sth=$dbh->prepare("SELECT * FROM Videos WHERE $FieldN LIKE +?") or die; $sth->execute($SearchCrit); @vidinfo = $sth->fetchrow_array();
into an array of hashes
so that this bit (below)will output
it properly???
all help gratefully received..$tmpl->param( stuff =>\@whatever ); $tmpl->output;
|
---|
Replies are listed 'Best First'. | |
---|---|
(dkubb) Re: (2) Outputing data from mySQL query into format for use with HTML::Template
by dkubb (Deacon) on Mar 10, 2001 at 08:11 UTC | |
Re: Outputing data from mySQL query into format for use with HTML::Template
by Masem (Monsignor) on Mar 10, 2001 at 03:08 UTC | |
Re: Outputing data from mySQL query into format for use with HTML::Template
by lachoy (Parson) on Mar 10, 2001 at 03:07 UTC | |
by sutch (Curate) on Mar 10, 2001 at 05:52 UTC |
Back to
Seekers of Perl Wisdom