[Ilugc] Urgent Help on Perl CGi

  • From: mailtojp76@xxxxxxxxx (prakash)
  • Date: Sat Aug 21 16:31:18 2004

 Hi All, 
           This is prakash from image infotainment Ltd .am having problem in 
connecting postgres sql using perl cgi. 

Server Details 
-------------------------- 
Apache 
Postgres 7.4.1 
Linux Mandrake 9.1 
------------------------- 

these is my sample script. 
-------------------------- 
       #!/usr/bin/perl -w 
       print "Content-type: text/html\n\n"; 
       use CGI; 
       use DBI; 

       $dbh = DBI->connect('dbi:Pg:dbname=testdb1','user1','user1'); 
       #my $sql = qq{Select * from featuredprogram}; 
       my $sth = $dbh->prepare("Select * from featuredprogram"); 
       $sth->execute(); 
       print $sql; 
       print "<Table align='center'><tr><td colspan='2'>Data List</td></tr>"; 
       $cnt=0; 
       while($row=$sth->fetchrow_hashref) 
       { 
         $cnt++; 
         print "<tr><td>"; 
         print $row->{fpid}; 
         print "</td><td>"; 
         print $row->{fpdescription}; 
         print "</td></tr>"; 

       } 
           print "<tr><td colspan='2' align='center'>$cnt</td></tr>"; 
           print "</Table>"; 


getting following error msg 

--------------apache error.log------------------------------- 
failed: FATAL:  IDENT authentication failed for user "user" at 
/var/www/cgi-bin/select1.cgi line 6 
Can't call method "prepare" on an undefined value at 
/var/www/cgi-bin/select1.cgi line 8. 
---------------------------------------------------------- 
kindly provide me a solution.......

Thanx, 
Prakash 





                
---------------------------------
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.ae.iitm.ac.in/pipermail/ilugc/attachments/20040821/4807aceb/attachment.htm

Other related posts: