Jump to content

Perl problem


Pranav
 Share

Recommended Posts

Hi have bought a new domain in windows 2003 server. I have created a database in MSSQL and

i am trying to access its content by click on a simple submit button in a HTML page

<html>

<head>

<title>Secure Page</title>

</head>

<body>

<form action="cgi-bin\show.pl" method="post">

<br>

<h3>Click here to view the registered users</h3>

<input type=submit>

</form>

</body>

</html>

here is the perl code which accesses the MSSQL database.

use DBI;

use strict;

my $dbh=DBI->connect("DBI:MSSQL:database","username","password")

or die "Cannot connect...\n".DBI->errstr();

#Fetch from Database...

my $sth=$dbh->prepare("select * from table") or die "Cannot prepare...\n".$dbh->errstr();

$sth->execute();

print "Content-type: text/html","\n\n";

print "<html>","\n";

print "<head><title>Secure page</title></head>","\n";

print "<body>","\n";

print "<table border=1 ><tr><th>Name</th><th>Year</th><th>Course</th><th>College</th><th>Address</th><th>Event</th>

<th>Phone</th><th>Email</th><th>Accom</th><th>Phone</th><th>Email</th><th>Date</th></tr>\n";

my($name,$year,$course,$college,$address,$event,$phone,$email,$accom,$dat);

while(($name,$year,$course,$college,$address,$event,$phone,$email,$accom,$dat)=$sth->fetchrow())

{#enter I have put only so that this code fits in this window

print "<tr><th>$name</th><th>$year</th><th>$course</th><th>$college</th><th>$address</th>

<th>$event</th><th>$phone</th><th>$email</th><th>$accom</th><th>$dat</th><th>$phone</th>

<th>$email</th></tr>\n\n";

}

print "</table></body></html>\n";

$sth->finish();

$dbh->disconnect();

When i run the code on my system(in mysql), i don't get any error. However when i run the same

code on my domain having, i get the following error message on my browser.

CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.

I have already tried assiging execute & read permission to the file but the problem still

persists. Please tell me what is wrong?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy