cgi script to connect to database and diaplay data in HTML throwing error

cgi script to connect to database and diaplay data in HTML throwing error

am 20.10.2007 19:22:55 von nitikamehta23

I am new to cgi and have a query about same...
I wan to connect to database and display soem data in HTMl format.
Below is the code which i have wriiten.
DbSettings.Pets contains database information like username,pswd,Db
name.

When i run this cgi using " http://www.web.com/TEST/cgi-bin-kerb/test.cgi"
it displays " Page cannot be displayed"

Can somebody help e out with this?

Thanks,

#!/opt/bin/perl5.004
#*************************
#******* Trecs.cgi *****
#*************************
#$Log

require "DbSettings.Pets";

Sybase::DBlib::dberrhandle('error_handler');
Sybase::DBlib::dbmsghandle('message_handler');

use CGI;

$query = new CGI;

&Main ();

$dbproc->dbclose();

sub Main {

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

&GetRegions;
&display_menu;

sub GetRegions
{
#print "SELECT distinct Region FROM ACCOUNTS ORDER BY Region";
@RegionData = $dbproc->sql("SELECT CheckName FROM CheckTb");
$NumRegions = @RegionData;
#print "Number of Rgions:$NumRegions";
}

sub display_menu {
print <




ICOLT--

CHECKNAME:



EOF

} #Main

#*********************************************************** **************************
#******************** error handler
***********************************************
#*********************************************************** **************************


sub error_handler
{

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

my ($db, $severity, $error, $os_error, $error_msg,
$os_error_msg) = @_;

# Check the error code to see if we should report this.
# Traps operating system level errors; much more severe than
sql related errors
# Add whatever code necessary to handle the error properly

print "Error detected:
";
print "severity: $severity
";
print "error: $error
";
print "database: $db
";
print "message: $error_msg
";
print "os error msg: $os_error_msg
";
INT_CANCEL;
}

sub message_handler
{
print "Content-type: text/html\n\n";

my ($db, $message, $state, $severity, $text, $server,
$procedure, $line) = @_;
# Used to trap Sybase messages generated in cases like trying
to
# insert a row that violates an index. Currently we don't do
anything,
# add whatever code necessary to handle the message properly

print "Message detected:
";
print "database: $db
";
print "message: $message
";
print "text: $text
";
print "server: $server
";
print "line no: $line
n";
0;
}