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:
Perl script in HTML file

 



dpuk44
Novice

Jul 30, 2011, 5:18 AM

Post #1 of 4 (1213 views)
Perl script in HTML file Can't Post

Hi folks, i'm fairly new to Perl. I am trying to understand how to display my Perl script in a html page.

1). I have a MySQL database called perltest.

2). I have my Perl script that links to the database called test.pl.



#!C:/Perl/bin

use DBI;
$dbh = DBI->connect('dbi:mysql:perltest','root','root')
or die "Connection Error: $DBI::errstr\n";
$sql = "select * from samples";
$sth = $dbh->prepare($sql);
$sth->execute
or die "SQL Error: $DBI::errstr\n";
while (@row = $sth->fetchrow_array) {
print "@row\n";
}


Now I want to display this into a webpage (html file), but im dont know where to begin. Any help would be much apprciated. Can I do this locally on my machine?


FishMonger
Veteran / Moderator

Jul 31, 2011, 7:42 AM

Post #2 of 4 (1169 views)
Re: [dpuk44] Perl script in HTML file [In reply to] Can't Post

Do you want to display the code of the script in the web page or the results returned from the db?


dpuk44
Novice

Jul 31, 2011, 11:18 AM

Post #3 of 4 (1162 views)
Re: [FishMonger] Perl script in HTML file [In reply to] Can't Post

I would like to display the results of my script into a webpage. Im basically trying to slowly learn to build my own shopping cart (eventually) Unimpressed


FishMonger
Veteran / Moderator

Jul 31, 2011, 1:09 PM

Post #4 of 4 (1148 views)
Re: [dpuk44] Perl script in HTML file [In reply to] Can't Post

Start by reading the documentation for the CGI module.
http://search.cpan.org/~markstos/CGI.pm-3.55/lib/CGI.pm

 
 


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

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