List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 12 1999 8:41am
Subject:Re: how to know which area have a problem under win32
View as plain text  
At 00:40, 19990812, sungeiway wrote:
>The problem is when i write a cgi program and try to access
>mysql database from my browser, it prompt out with "Document
>contains no data".  How do i going to check whether this error
>occured just because bad cgi program or DBI not functions or/may
>be DBD not function?? or mysql failed in somewhere during the

Sungeiway, you will find good answers to this question on the
news group comp.infosystems.www.*.cgi.

But I will give you a not-so-good answer, perhaps.

First, get this CGI script to work:

------------- Cut here -------------------------

print "Content-type: text/plain\n\nIt works.\n";
exit 0;
------------- Cut here -------------------------

Once that works, get this one working:

------------- Cut here -------------------------

use CGI ':standard';

print header(), "It works.<br>\n";

exit 0;
------------- Cut here -------------------------

Now, try this:

------------- Cut here -------------------------

use CGI ':standard';
use DBI;

# you may need to change these values
my $dbname =    'test';
my $user =      '';
my $password =  '';

print header();

my $dbh = DBI->connect("DBI:mysql:$dbname", $user, $password);

unless ($dbh) {
    print "could not connect to database: $DBI::errstr\n";
    exit 1;


print "It works.<br>\n";

exit 0;
------------- Cut here -------------------------

You now have a script that is connecting to the database.  You
have eliminated, step by step, all of the problems you have had,
and you feel tired, but happy, knowing that the same method of
reducing a problem to its simplest parts and dealing with each
part individually will enable you to handle any task you may
stumble into up ahead.


how to know which area have a problem under win32sungeiway12 Aug
  • Re: how to know which area have a problem under win32Thimble Smith12 Aug