PDA

View Full Version : connection to mysql on linux(apache)web server


payalc
09-02-2004, 10:41 AM
hello,
i want to do access data from mysql 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.