CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Iconx] CGI::Application and MySQL: Edit Log



FishMonger
Veteran / Moderator

Mar 4, 2015, 7:15 AM


Views: 10967
Re: [Iconx] CGI::Application and MySQL


Quote
Can someone show me an example of using CGI::Application with HTML::Template to query a mysql database

Sorry, we can't do that because neither of those modules are used to query a database.

The modules you're looking for are DBI and DBD::mysql
http://search.cpan.org/~timb/DBI-1.633/DBI.pm
http://search.cpan.org/~capttofu/DBD-mysql-4.029/lib/DBD/mysql.pm

If your query returns multiple rows, then the data structure you pass to the template will be an array of hash refs. The template would use the TMPL_LOOP tag to loop over that array.
http://search.cpan.org/~wonko/HTML-Template-2.95/lib/HTML/Template.pm#TMPL_LOOP


(This post was edited by FishMonger on Mar 4, 2015, 7:15 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Mar 4, 2015, 7:15 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives