Also, outside of the loop you're printing the variable "p1", not "field1". That's why that value is printing.
>print "<a href=/cgi-bin/next.pl?field1=$p1&field2=$field2>go here</a>"; Andy -----Original Message----- From: Ronald J Kimball [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 09, 2005 4:43 PM To: 'MCMULLIN, NANCY'; [email protected] Subject: RE: Retrieve values from Oracle MCMULLIN, NANCY [mailto:[EMAIL PROTECTED] wrote: > > Here's the easiest question you've had all day ;-) > I'm attempting to retrieve values and pass them to another program. But > I'm only able to grab and save the first value. What do I have wrong? > > CODE snippet: > my $sth = $dbh->prepare("SELECT field1, field2 FROM table WHERE field1 > = '$p1'") > or die "Preparing: ", $dbh->errstr; > $sth->execute or die "Executing: ", $sth->errstr; > while (my $row = $sth->fetchrow_arrayref()) > { > print Tr( td( $field1, $field2 ) ); > # note - I can print both values here > } Your code sample does not appear to be complete. I do not see how the values get into $field1 and $field2. BTW, you should be using placeholders rather than interpolating $p1 directly into your SQL statement. You are opening yourself up to SQL injection attacks. my $sth = $dbh->prepare("SELECT field1, field2 FROM table WHERE field1 = ?") or die "Preparing: ", $dbh->errstr; $sth->execute($p1) or die "Executing: ", $sth->errstr; Ronald
