Doyle has asked for the wisdom of the Perl Monks concerning the following question:
Thanks guys#!/usr/bin/perl -w ################################################# ## This is an Example of how to Connect to an ## Access Database using a DSN-less Connection ################################################# use POSIX; use strict; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use DBI; ######################################### ## Create the Connection String ## To use a DSN just replace the string ## with the DSN name. ######################################### my $DSN = 'driver=Microsoft Access Driver (*.mdb);dbq=c:\\Inetpub\ +\domains\\rvnuccio.com\\doytest\\cgi-bin\\Clients.mdb'; my $dbh = DBI->connect("dbi:ODBC:$DSN", '','') or die "$DBI::errstr\n"; ############################### ## Generate SQL Statement ############################### my $sql = "Select 'John Smith' from TblOne"; # my $sql ="Select ClientName from Billing"; ############################### ## Prepare and execute the ## SQL Statement ############################### my $loadHandle = $dbh->prepare($sql); $loadHandle->execute|| die "Could not execute SQL statement ... maybe invalid?"; print header; print "<html><head><title>SUBMITTED QUOTES</title></head>\n"; print "<body BGCOLOR=\"#D3F2FC\"><CENTER><h3>Submitted Quotes</h3>< +/CENTER>\n"; print "<form action=\"http://www.rvnuccio.com/doytest/cgi-bin/getur +l.pl\" method=\"GET\">\n"; print "<BR>\n"; print "<TABLE id=Table1 cellSpacing=1 cellPadding=1 width=300 align +=center border=0>"; print "<TR>"; print "<TD></TD>"; print "</TR>"; print "<TR>"; print "<TD align=left>Name</TD>"; print "<TD></TD>"; print "<TD></TD>"; print "</TR>"; print "<TR>"; print "<TD></TD>"; print "<TD></TD>"; print "</TR>"; ###################################################################### +########################## my @row; while (@row=$loadHandle->fetchrow_array) { print "<TR>"; print "<TD align=Left><input type=\"checkbox\" name = @row>@row< +/TD>"; print "</TR>"; ################################ } print "<TR>"; print "<TD></TD>"; print "</TR>"; print "<TR>"; print "<TD><input type=\"submit\" value=\"Send Information\"></TD>" +; print "<TD></TD>"; print "<TD></TD>"; print "</TR>"; print "<TD align=right><INPUT type=button value=Return name=Button1 + onClick=\"parent.location='http://www.rvnuccio.com/doytest/applicati +ons/pec/application/online/Admin.html'\"></TD>"; print "</TABLE>"; print " \;"; print " \;"; print "</form>\n"; print "\n</body></html>\n"; ######################################### ## Close the connection when finished: ######################################### $dbh->disconnect; #!/usr/bin/perl #geturl.pl #Get header, ender, define the page title ## require "c:\\Inetpub\\domains\\rvnuccio.com\\doytest\\cgi-bin\\g +eturl.pl"; $Title = "Get Information from a url"; #Get the query string $QueryString = $ENV{'QUERY_STRING'}; #Use split to make an array of name-value pairs @NameValuePairs = split (/&/, $QueryString); # @NameValuePairs = $QueryString; # print @NameValuePairs #Put up an HTML header, page title and a rule print "Content-type: text/html\n\n"; print "<BODY>\n"; print "<H1>$Title</H1>\n"; print "<HR>\n"; #Split each of the name-value pairs and print them on the page foreach $NameValue (@NameValuePairs) { ($Name, $Value) = split(/=/, $NameValue, 2); print "Name = $Name, value = $Value<BR>\n"; }
2005-03-02 Janitored by Arunbear - added readmore tags, as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning a single record
by rnahi (Curate) on Mar 01, 2005 at 15:44 UTC | |
|
Re: Returning a single record
by halley (Prior) on Mar 01, 2005 at 15:22 UTC | |
|
Re: Returning a single record
by Joost (Canon) on Mar 01, 2005 at 15:23 UTC | |
|
Re: Returning a single record
by Taulmarill (Deacon) on Mar 01, 2005 at 15:22 UTC | |
by Doyle (Acolyte) on Mar 01, 2005 at 15:31 UTC | |
|
Re: Returning a single record
by punkish (Priest) on Mar 01, 2005 at 20:00 UTC |