Sorry about the vague topic, don't know how to describe the problem.

My code runs OK in the console and does what it is meant to do. In the
browser it doesn't die or give any errors, but only does about half of
what it is meant to do before it magically stops with no errors.

If you look at the below code, it gets as far as:
while ( ( my $store ) =  $sth->fetchrow_array ) {
        print "<OPTION VALUE=\"$store\" >$store</OPTION>\n";
}
Now it falls over during this loop, there about 250 records it needs to
print and stops randomly between the first record and sometimes near the 
last. but there are no error messages, the script thinks that it has
done everything. I hope this makes some sense, as i have no idea how to
troubleshoot this problem and all the FAQs and docs mentioned in
perlfaq? don't seem to have answers.

I'm running Perl 5.6.0 with apache 1.3

TIA
Merritt


sub fetch
{
        my $dsn   = 'dbi:Pg:dbname=foo;host=172.30.2.253;port=5432';
        my $username = "bar";
        my $password = "baz";
        # make connection
        my $dbh = DBI->connect ($dsn, $username, $password, {
                PrintError => 1,
                RaiseError => 0
} )
        or warn "Can't connect to the PG database: $DBI::errstr\n";
# SELECT store
my $sth = $dbh->prepare( "
        SELECT  store_number FROM store ORDER BY store_number
        " ) or warn "SELECT: $DBI::errstr<BR>";
$sth->execute( ) or warn "EXEC: $DBI::errstr<BR>";
print "Store Number:";
print "<SELECT NAME=\"store\">\n";
print "<OPTION SELECTED></OPTION>\n";
while ( ( my $store ) =  $sth->fetchrow_array ) {
        print "<OPTION VALUE=\"$store\" >$store</OPTION>\n";
}
print "</SELECT><BR>\n";
# Disconnect from Pg DB
$dbh->disconnect or warn "Disconnection Failed: $DBI::errstr<BR>";
}

Attachment: msg07046/pgp00000.pgp
Description: PGP signature

Reply via email to