It looks like a big part of the problem might be that you are not defining
a username or database to access $db with. if you run the script from the
command line, mysql will use the ones defined in your environment.
I would add a few "or die"s and check $DBI::errstr when you do, or
print debugging info to STDERR (the apache error log).
darren
bureau madras ([EMAIL PROTECTED]) wrote:
> Respected Sir/Madam,
>
> We would like you to help us out in our doubts. We are working in Linux
> platform using Mysql as database and our scripting language is
> Perl. We are using Apache Web server. We have written a program in PERL to
> access database and fetch some records. When we execute the PERL program
> separately we are able to access the database and the records are fetched.
> But when the same perl code is called through a html page the records are
> not fetched.
>
> Is this problem because of some configuration not done in apache to access
> Mysql or is it some other problem?If we have to access Mysql through html
> page do we have to do any configuration on the Apache configuration files?
> The perl and html codes are as follows:
>
> HTML CODE:(try.html)
> ====================
> <html><body>
> <form action=/cgi-bin/try.pl>
> <input name=login>
> <input name=pwd>
> <input type=submit>
> </form></body></html>
>
> PERL CODE:(try.pl)
> ==================
> #! /usr/bin/perl
> print "Content-type:text/plain \n\n";
> $val=$ENV{QUERY_STRING};
> print "Value is : $val";
> use DBI;
> $con=DBI->connect("DBI:mysql:$db") # where $db is the database
> $result=$con->prepare("select * from tab");
> $result->execute;
> print DBI::dump_results($result);
>
> Now when we execute the perl code from the dos prompt we get the output
> right but when the same code is accessed through html page , though we do
> not get any error the database is not accessed and the records are not
> fetched.
> It would be kind of you if you would reply us what would possibly be the
> reason for the program not working through html page.We are online and would
> appreciate it if you could reply immediately to our mail.
> Thanks,
> Regards,
> for Treasure Solutions Software Pvt. Ltd.
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
--
Whether you can hear it or not the Universe is laughing behind your back.