List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:May 17 1999 4:36pm
Subject:Re: DBI WORKS PERFECTLY IN COMMANd LINE but is not working in APACHE
WEBSERVER !!!
View as plain text  
christopher sagayam wrote:
> 
> HELLO
> 
> I HAVE WRITTEN A CODE IN PERL 5.005_56.
> 
> MY CODE WORKS PERFECTLY IN COMMAND LINE (IE ) perl myprgram.PL.
> 
> But I try to access it using APACHE and  it is not working.
> 
> I have written lot of cgi-scripts for my company , I am quite well
> versed in CGI .
> 
> use CGI;
> ------------
> bla bla and bla
> -------------------
> use DBI;
> $dbh = new DBI;
> # STEP 1
> #===============================
> $connect = $dbh->connect(DBI:mysql:mydatabase);
> print "error check1";
> #STEP 2
> #================================
> $sql = "SELECT mycolumnname FROM mytablename";
> print "error check2";
> #STEP 3
> #------------------------------------
> $handle = $dbh->prepare($sql);
> print "error check3";
> #STEP 4
> #===========================================
> $handle->execute();
> print "error check4";
> #STEP 5
> #===========================================
> $var1  = $handle->bind_column(undef , /$var1);
> print "error check5";
> # STEP 6
> #================================================
> while ($handle->fetch())
> {
> print "error check6";
> print "$var1";
> }
> $handle->finish;
> $dbh->disconnect;
> 
> also I am using CGI.pm.
> 
> MY CODE WORKS PERFECTLY IN THE COMMAND LINE ie perl 'Myprog.pl'
> But If I execute it from my APACHE WEB SERVER.
> I get the first 2 messages (ie) errorcheck1 and errorcheck2
> But nothing is printed after that.( I am using netscape navigator);
> 
> PLEASE HELP ME !!!
> 
> I MIGHT LOSE MY JOB BECAUSE OF THIS !!!!
> 
> christopher
> 
> christopher_sagx@stripped
> 

Christopher:

The correct way to print a DBI error message is 

 print "DBI error: ${DBI:errstr}";

which is what Vivek is suggesting.

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
DBI WORKS PERFECTLY IN COMMANd LINE but is not working in APACHE WEBSERVER !!!christopher sagayam17 May
  • Re: DBI WORKS PERFECTLY IN COMMANd LINE but is not working in APACHE WEBSERVER !!!Vivek Khera17 May
  • Re: DBI WORKS PERFECTLY IN COMMANd LINE but is not working in APACHE WEBSERVER !!!Sasha Pachev17 May
  • Re: DBI WORKS PERFECTLY IN COMMANd LINE but is not working in APACHE WEBSERVER !!!Oliver Artelt17 May