in reply to SQL ERROR

<guessing mode="on">It looks as if your DBH-handle is not properly set. Do you check for errors when you connect to the database?<guessing mode="off">

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: SQL ERROR
by WebDev (Initiate) on Nov 15, 2004 at 19:02 UTC
    I am doing some error checking. Here is my code:
    sub executeQuery { eval{$sqlH = $dbh->prepare($sql);}; if ($@) {print "Database Error: " . $dbh->errstr();exit;} print "Prepared\n"; eval{$sqlH->execute();}; if ($@) {print "Database Error: " . $dbh->errstr();exit;} }
      I think the error might be in your connect statement. Try something like

      my $dbh=DBI->connect(YOUR_CONNECT_INFO_HERE) or die "Cannot connect to the database: $DBI::errstr";

      and see what it says.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

        I have connected to my database, using your method. I am trying to get a 7day week of anniversaries. I can get 2 days worth and then it errors off. See previous SQL statement. When I run the code i get the following error but it still runs
        Use of uninitialized value in string ne at Test.pl line 213.
        I have a database connection statement.