in reply to perl DBI help

one thing i saw immediately is that you have an unecessary use DBI; in the connect sub, that may cause your $dbh to go out of scope, i'm not sure. Problem with the script as it is now, it that you are not error checking So you are not raising and error until you actully try to fetch data.

Try something like this on each DB call to pinpoint the problem

$dbh= DBI->connect("DBI:mysql:host=localhost;database=testsites","qaus er","blah",{PrintError => 0, RaiseError => 1}) or die $DBI::errstr; -and- $sth = $dbh->prepare ($stmt) or die $dbh->errstr;
Update: swiftone has a good eye. I believe the finish call is your real problem. but ALWAYS check for failure on db calls.

Replies are listed 'Best First'.
Re: Re: perl DBI help
by swiftone (Curate) on Sep 26, 2002 at 20:58 UTC
    A hundred use DBI; shouldn't affect anything -- that's the beauty of use.
      I trust that you are correct on that. I still recommend deleting the redundant one.