It should be PrintError (capital 'E').

ie.
---
$dbh = DBI->connect($dsn, $user, $pwd,{PrintError =>
0, RaiseError => 1});

Nicholas

-----Original Message-----
From: Investor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 15, 2002 2:43 PM
To: [EMAIL PROTECTED]
Subject: Error with code utilizing perl DBI & mysql ??



This is a bit strange, but I was writing code
and adding some select statements that seemed to be
working fine until about the 5 th one,  ...
then i get errors :

I am a bit of a newbie at mysql & dbi.....

any help much appreciated

Error:
Can't set DBI::db-HASH(0x1b73b70->{Printerror}:
unrecongnised attribute at
C:/indogoperl/site/lib/DBI.pm line 441.
Issuing rollback() for database handle being DESTROY'd
without explicit disconnect().

<Code>
use DBI;
my $dir = "C:/indigoperl/bin";
my $file1 = "out1.txt";
my $file2 = "out2.txt";
my $file3 = "out3.txt";
my $file4 = "out4.txt";
my $file5 = "out5.txt";

open(F1, ">$dir/$file1") or warn "Did not open $file1:
$!\n";
open(F2, ">$dir/$file2") or warn "Did not open $file1:
$!\n";
open(F3, ">$dir/$file3") or warn "Did not open $file1:
$!\n";
open(F4, ">$dir/$file4") or warn "Did not open $file1:
$!\n";
open(F5, ">$dir/$file5") or warn "Did not open $file1:
$!\n";

my ($dbh, $sth, $count, $dsn, $user, $pwd);
my ($flag, $sic, $sic2, $sic3);
my ($cite, $reg);

$dsn = "DBI:mysql:host=localhost;database=air";
$user = "root";
$pwd = "wick";
$dbh = DBI->connect($dsn, $user, $pwd,{Printerror =>
0, RaiseError => 1});

#  Table sicc
$flag =Y;
print " Enter data for sicc table? 'y' or 'n'\n";
chomp($flag = <STDIN>);
while ( uc($flag) eq 'Y') {  
print " Enter values for sic, sic2, sic3 separate with
commas \n";
chomp($dat = <STDIN>);
($sic, $sic2, $sic3) = split (/,/, $dat);
$dbh->do (" INSERT INTO sicc (sic, sic2, sic3) values
(?,?,?) " ,
                        undef, $sic, $sic2, $sic3);
print F1 "Enter new row of data:   'y' or 'n' \n";
chomp($flag = <STDIN>);
undef $sic, $sic2, $sic3, $dat;
} # end of while for table sicc

# Table permitno
$f2=Y;
print " Enter data for permitno table? 'y' or 'n'\n";
chomp($f2 = <STDIN>);
while ( uc($f2) eq 'Y') {  
print " Enter values for pn, datep separate with
commas \n";
chomp($dat = <STDIN>);
($pn, $datep) = split (/,/, $dat);
$dbh->do (" INSERT INTO permitno (pn,datep) values
(?,?) " ,
                        undef, $pn, $datep );
print "Enter new row of data:   'y' or 'n' \n";
chomp($f2 = <STDIN>);
undef $pn, $datep, $dat;
}  # End of while for table permitno

# Table equip
$f3=Y;

while ( uc($f3) eq 'Y') {  
print " Enter value for type  \n";
chomp($dat = <STDIN>);
($type) = split (/,/, $dat);
$dbh->do (" INSERT INTO equip (type) values (?) " ,
                        undef, $type );
print "Enter new row of data:   'y' or 'n' \n";
chomp($f3 = <STDIN>);
undef $type, $dat;
}  # End of while for table permitno

# Table regs
$f4 = Y;
while ( uc($f4) eq 'Y') {  
print " Enter values cite and reg  \n";
chomp($dat = <STDIN>);
($cite, $reg) = split (/,/, $dat);
$dbh->do (" INSERT INTO regs (cite, reg) values (?,?)
" ,
                        undef, $cite, $reg );
print "Enter new row of data:   'y' or 'n' \n";
chomp($f4 = <STDIN>);
undef $cite, $reg, $dat;
}  # End of while for table regs

# Table refs
$f5 = Y;
while ( uc($f5) eq 'Y') {  
print " Enter value for ref \n";
chomp($dat = <STDIN>);
($ref) = split (/,/, $dat);
$dbh->do (" INSERT INTO refs (ref) values (?) " ,
                        undef, $ref );
print "Enter new row of data:   'y' or 'n' \n";
chomp($f5 = <STDIN>);
undef $ref, $dat;
}  # End of while for table refs


$sth=$dbh->prepare ("SELECT *  FROM  sicc");
$sth->execute ();
$count = 0;
while (my $ref = $sth ->fetchrow_hashref () )  {
        print F3 "Found a row: sic_id =$ref->{'sic_id'}, sic
=$ref->{'sic'}, sic2= $ref->{'sic2'}, 
sic3=$ref->{'sic3'}\n";
        ++$count;
}
$sth->finish();
print "$count rows total\n";


$sth=$dbh->prepare ("SELECT *  FROM  permitno");
$sth->execute ();
$count = 0;
while (my $ref = $sth ->fetchrow_hashref () )  {
        print F2 "Found a row: pn_id =$ref->{'pn_id'}, datep
=$ref->{'datep'}, pn= $ref->{'pn'}\n";
        ++$count;
}
$sth->finish();
print "$count rows total\n";

$sth=$dbh->prepare ("SELECT *  FROM  equip");
$sth->execute ();
$count = 0;
while (my $ref = $sth ->fetchrow_hashref () )  {
        print F3 "Row $count:   type_id =$ref->{'type_id'},
type =$ref->{'type'}\n";
        ++$count;
}
$sth->finish();
print "$count rows total\n";

$sth=$dbh->prepare ("SELECT *  FROM  regs");
$sth->execute ();
$count = 0;
while (my $ref = $sth ->fetchrow_hashref () )  {
        print F4 "Row $count:   reg_id =$ref->{'reg_id'},
cite =$ref->{'cite'}, reg =$ref->{'reg'}\n";
        ++$count;
}
$sth->finish();
print "$count rows total\n";

$sth=$dbh->prepare ("SELECT *  FROM  refs");
$sth->execute ();
$count = 0;
while (my $ref = $sth ->fetchrow_hashref () )  {
        print F5 "Row $count:   ref_id =$ref->{'ref_id'}, ref
=$ref->{'ref'}\n";
        ++$count;
}
$sth->finish();
print "$count rows total\n";


close (F1);
close (F2);
close (F3);
close (F4);
close (F5);
$dbh->disconnect ();
$dbh->disconnect ();
$dbh->disconnect ();
$dbh->disconnect ();
$dbh->disconnect ();
$dbh->disconnect ();


exit (0);
</code>


=====
Regards,

Investorclb

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to