in reply to Re: Update on checkbox queries- revamped code and STILL getting blank screen..........Can anyone help?
in thread Checkbox Query Revisited

This is what the error log said. Any help would be greatly appreciated:)

Software error:

Can't call method "execute" on an undefined value at line 51.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

  • Comment on Re: Re: Update on checkbox queries- revamped code and STILL getting blank screen..........Can anyone help?

Replies are listed 'Best First'.
Re: Re: Re: Update on checkbox queries- revamped code and STILL getting blank screen..........Can anyone help?
by tommyw (Hermit) on Nov 22, 2002 at 12:12 UTC

    The only occurance of execute in the script is

    $sth->execute || die "Could not execute SQL statement ... " . $dbh->errstr;
    I hope this is line 51.

    This seems a bit odd to me, as you ought to be finding that error string in the log file. But the implication is clearly that $sth is undefined. The only way this can be happening is if the prepare on the previous line has failed. And you're not error trapping that.

    (I no nothing about odbc, but the line if     ($where_clause) in the middle of the sql statement looks odd to me)

    And I'm confused about the error trapping anyway: you've set RaiseError to 1, so every statement ought to be error trapped by DBI anyway. Which would explain why you don't see the "Could not execute SQL statement" in the log: DBI has died before your code gets a chance to. But it doesn't explain why the prepare doesn't result in death. Odd.

    --
    Tommy
    Too stupid to live.
    Too stubborn to die.

Re: Re: Re: Update on checkbox queries- revamped code and STILL getting blank screen..........Can anyone help?
by Zaxo (Archbishop) on Nov 22, 2002 at 12:35 UTC

    That says that $sth is undefined. In the line:     my $sth = $dbh->prepare($sql); the right hand side is evaluating to undef. Either prepare() is failing, or $dbh itself is undefined. Try adding a die clause:

    my $sth = $dbh->prepare($sql) or die "No sth: '$DBI::ErrStr'", $!;
    With luck, you'll get something telling what the database doesn't like.

    Do you see a pattern forming here? Always check for errors when you go to the system!

    After Compline,
    Zaxo