setting RaiseError to true is the way to go in DBI.
it catches most of the error and prints in apache error log.
if RaiseError = 1 one does not have to do the explicit
die after the connect even i think
regds
mallah,
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> You should not be using the "do" method, but the prepare/execute model instead. Using
> placeholders can not only be more efficient but allows quoting to happen properly. Here is a
> rewrite:
>
> #--Establish the DB connection
> #--Assign the DB name
> my $dbName = 'checkbook';
> my $dbuser = "joe";
> my $dbpass = "sixpak";
>
> my $dbh = DBI->connect("dbi:Pg:dbname=$dbName", $dbuser, $dbpass, {AutoCommit=>1,
> RaiseError=>1})
> or die "Could not connect to the database: $DBI::errstr\n";
>
> my $SQL = "
> INSERT INTO transactions (date,description,amount,confirmation,nameid,typeid) VALUES
> (? ,? ,? ,? ,? ,? )";
>
> my $sth = $dbh->prepare($SQL);
>
> my $count = $sth->execute($datePaid,$description,$amount, $confirmation,$nameid,$typeid);
>
> print "Insert count: $count\n";
>
>
> It is hard to tell why your inserts are going wrong without more information, but the
> RaiseError should at least help catch some obvious errors.
>
>
> - --
> Greg Sabino Mullane greg@turnstep.com
> PGP Key: 0x14964AC8 200306181337
>
> -----BEGIN PGP SIGNATURE-----
> Comment: http://www.turnstep.com/pgp.html
>
> iD8DBQE+8KUHvJuQZxSWSsgRAhWoAJ9/aw9AaCMa5vGvEpvujEEBm4iBXQCggSSw
> jPaGcdMt9Qq9XeJqttvdX48=
> =x1nu
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to
> increase your free space map settings
-----------------------------------------
Get your free web based email at trade-india.com.
"India's Leading B2B eMarketplace.!"
http://www.trade-india.com/