in reply to Re: Re: •Re: Method "do" error
in thread Method "do" error

Hi,

I tried your suggestion.

First, I did remove the $dbh from the subrouting and received an internal server error message.
Secondly, I also change my $dbh to our $dbh in hopes that would solve the problem. I received the same internal server error message.

I included the modified code. Any other ideas or thoughts?

#! /usr/local/bin/perl -Tw use strict; use lib qw(/usr163/home/w/s/wstrader/public_html/library); use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard escape escapeHTML); use WebDB; our $dbh = WebDB::connect (); my $name = param("name"); my $coname = param("coname"); my $phone = param("phone"); my $email = param("email"); my $address = param("address"); my $city = param("city"); my $state = param("state"); my $zip = param("zip"); my $country = param("country"); my $page; my $choice = lc (param ("choice")); if ($choice eq "submit") # information submitted via form { store_items (); } else { $page .= p (escapeHTML ("Logic error, unknown choice: $choice")); } sub store_items { $dbh->do ("INSERT INTO contact_info (contact_date,contact_name,company,telephone,email,addre +ss,city,state,zip_code,country) VALUES (CURRENT_DATE,?,?,?,?,?,?,?,?,?)", undef, $name, $coname, $phone, $email, $address, $city, $state, $zip, $country); $dbh->disconnect(); }

Replies are listed 'Best First'.
Re: Re: Re: Re: •Re: Method "do" error
by grep (Monsignor) on Apr 20, 2003 at 20:39 UTC
    If WebDB::connect is returning a DBI object, print it out.

    our $dbh = WebDB::connect() || die "Ohh no $!\n";; use Data::Dumper; print Dumper $dbh;

    You should see a hash structure that is blessed as a DBI object.

    grep
    Mynd you, mønk bites Kan be pretti nasti...

Re: Re: Re: Re: •Re: Method "do" error
by grantm (Parson) on Apr 20, 2003 at 22:21 UTC
    I did remove the $dbh from the subrouting and received an internal server error message.

    You need to track down the text of the Perl error which is causing the script to fail and which in turn is causing the web server to display the 'server error' page.

    The use CGI::Carp qw(fatalsToBrowser); line you already have should cause the Perl error to be passed to your browser but for some reason that's not happening. Can you get access to the web server's error log file? Or, can you run your script from the command line so the error message come to your terminal window?