473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

debugging the web application

hi,
am a newbie for internet programming and i wrote a perl script to
acess a mysql database on linux... but once i tried viewing the output
in a browser.. i was shown an error page... which said.. premature
ending of script headers.. if anyone can help me debug the perl
script...
-Nachiketh

perl script:
#!usr/bin/perl
use CGI;
use DBI;
$q = new CGI;
$pnr = $q -> param('pnr');

$dbh = DBI -> connect('DBI:mysql:sample','root','soccer');
$sql = "select * from railways where pnr_no = '$pnr'";

$sth = $dbh -> prepare($sql)
or die "cant prepare sql query $sql:$dbh->errstrn";

$rv = $sth -> execute
or die "cant execute sql query $sql:$dbh->errstrn";

while(@result = $sth -> fetchrow())
{
$key = $result[0];
$status = $result[1];
}

if ( $rv > 0)
{
if($status eq "Waiting" or $status eq "waiting")
{
print "Content-type: text/html","\n";
print "Pragma: no-cache","\n\n";
print "<HTML>\n";
print "<BODY>\n";
print "<H1>Your PNR number has been updated in our database and you
are in our waiting list</H1>\n";
print "</BODY>\n";
print "</HTML>";
$sth -> finish();
# $dbh -> disconnect();
}
else
{
$sql1 = "select * from details where pnr_no='$key'";
$sth1 = $dbh -> prepare($sql1)
or die "Unable to prepare the Query" ;
$rv1 = $sth1 -> execute()
or die "Unable to execute query";
while(@result1 = $sth1 -> fetchrow())
{
$pnr_no = $result1[0];
$coach_no = $result1[1];
$berth_no = $result1[2];
$train_name = $result1[3];
$train_no = $result1[4];
$time = $result1[5];
$date = $result1[6];
}
print "Content-type: text/html","\n";
print "Pragma: no-cache","\n\n";
print "<HTML>\n";
print "<BODY>";
print "<H1>Here are the details of your reservation</H1>\n";
print "<BR>Train Name: $train_name<BR>\n";
print "<BR>Train Number: $train_no<BR>\n";
print "<BR>Coach Number: $coach_no<BR>\n";
print "<BR>Berth Number: $berth_no<BR>\n";
print "<BR>Date Of Journey: $date<BR>\n";
print "<BR>Time Of Journey: $time<BR>\n";
print "WISH YOU A VERY HAPPY JOURNEY\n";
print "</BODY>\n";
print "</HTML>\n";
$sth1 -> finish();
$dbh -> disconnect();
}
}
else
{
$sth -> finish();
$dbh -> disconnect();
print "Content-type: text/html","\n";
print "Pragma: no-cache","\n\n";
print "<HTML>\n";
print "<BODY>\n";
print "<H1>Please Enter a Valid PNR number or your PNR Number does
not exist</H1>\n";
print "</BODY>";
print "</HTML>";
}
exit(0);
Jul 19 '05 #1
0 1201

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Wark | last post by:
I have a Windows 2003 Web server on which I was debugging remotely with no problems. I then moved this server to a different domain and now remote debugging will not work, the error is; ...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
5
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development...
3
by: gaugust | last post by:
I am running Visual Studio .Net 2003 with Windows XP Pro and SP2. I am tying to run an ASP .Net application in debug mode. In Web.Config file I have set debug="true" but I am getting an error:...
2
by: Tyrant Mikey | last post by:
Okay, I'm stumped. I'm writing a Visual Basic .NET Web Application and everything's been going marvelously until now. All of a sudden, Visual Studio will not debug the application. The application...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
6
by: KevinGPO | last post by:
I am currently developing a website in ASP (VBScript) using MS Visual C#.NET IDE. I just create a new "ASP.NET Web Application" and point to my local webserver (IIS) of my website address. Then I...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.