PDA

View Full Version : problem with connection to mysql


payalc
09-02-2004, 11:31 AM
hello,
i want to access data from mysql database using cgi-perl script.but when i run html form it gives me error "internal server error"
here is html file
<html>[b]
<form action="http://www.dentalcollegesangli.org/cgi-bin/student.pl", method="post" >
<input type="text" name="name" value=" " >
<input type="submit" value="submit">
</form></body></html>
& this is CGI-Perl script.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI qw (:standard);
use DBI;
$cgi=new CGI;
$drh = DBI->install_driver("mysql");
print $cgi->header;
$n=$cgi->param('name');
print "<html>[b]";
$con=DBI->connect("DBI:mysql:dentalcollegesangli:http://203.199.107.224","user","user123")||die "DBI->connect: $DBI::errstr ";
$q=$con->prepare("select * from merit where roll_no='$n'");
$q->execute();
while(@r=$q->fetchrow_array())
{
if($r[0] eq "")
{
print "[b]sorry not in merit list</b>";
}
else
{
print "Roll_no=$r[0]
";
print "Merit No=$r
";
print "Name=$r
";
pritn "Total Marks=$r
";
}
}
print"(/body></html>";
what is the problem.
if anybody have an idea help me
thank u in advance.

bruce
09-02-2004, 12:04 PM
Did you disable friendly error in your browser? 500 error is one of those error that can be caused by multiple things

See http://kb.discountasp.net/article.aspx?id=10052

Posting the error message after you disable friendly error.

[b]quote:Originally posted by payalc

hello,
i want to access data from mysql database using cgi-perl script.but when i run html form it gives me error "internal server error"
here is html file
<html>[b]
<form action="http://www.dentalcollegesangli.org/cgi-bin/student.pl", method="post" >
<input type="text" name="name" value=" " >
<input type="submit" value="submit">
</form></body></html>
& this is CGI-Perl script.
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI qw (:standard);
use DBI;
$cgi=new CGI;
$drh = DBI->install_driver("mysql");
print $cgi->header;
$n=$cgi->param('name');
print "<html>[b]";
$con=DBI->connect("DBI:mysql:dentalcollegesangli:http://203.199.107.224","user","user123")||die "DBI->connect: $DBI::errstr ";
$q=$con->prepare("select * from merit where roll_no='$n'");
$q->execute();
while(@r=$q->fetchrow_array())
{
if($r[0] eq "")
{
print "[b]sorry not in merit list</b>";
}
else
{
print "Roll_no=$r[0]
";
print "Merit No=$r
";
print "Name=$r
";
pritn "Total Marks=$r
";
}
}
print"(/body></html>";
what is the problem.
if anybody have an idea help me
thank u in advance.

</blockquote id="quote"></font id="quote">

B.

DiscountASP.NET
http://www.DiscountASP.NET