I want to return a single record from an access database and be able to go to the next record by clicking on a button. Here is my code...

#!/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 "&nbsp\;"; print "&nbsp\;"; 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"; }

Thanks guys

2005-03-02 Janitored by Arunbear - added readmore tags, as per Monastery guidelines


In reply to Returning a single record by Doyle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.