Hi I am new to perl CGI as you might guess with my question ...
I have a simeple CGI script that makes a Database connection and retreves the records.
When I run the script from the command line ..the html generated from the command Line works just fine,
But when I access it from the web ..the html before the actual CGI starts works but does not display the html after CGI part in the script.Am I missing something
The HTML that is visble up to
print "<font color=blue><i>Connection is being set";
after that it just does not show anything ...........
##########################
##########
##########
##########
#######
#!/usr/local/bin/perl -w
#
use DBI;
my $ora_host="########";
my $ora_sid="$$$";
my $ora_driver="Oracle";
my $ora_username="admin";
my $ora_password="$$$$$";
my $ora_port=1521;
my $dsn_ora="dbi:$ora_driver:
host=$ora_
host;sid=$
ora_sid;po
rt=$ora_po
rt";
print "Content-type: text/html\n\n";
print "<html><head><title>$$$$$$
$$$$$$</he
ad>\n\n";
print "<body link=darkgreen vlink=brown>\n";
print "<br><font size=+3 color=red>\n";
print "<center>^^^^^^^^^^^^^</fo
nt><br><br
><br>\n";
#initialization
$weekday=""; $isdaylight=""; $yearday="";
($sec, $min, $hr, $day, $mon, $yr, $weekday, $yearday, $isdaylight)=localtime(tim
e);
$mon++; $yr += 1900;
print "<font color=blue><i>You filed this query on $day/0$mon/$yr at
$hr:$hr:$min:$sec \n ";
print "<i></font></center>\n";
print "<hr><br>";
print "<font color=blue><i>Connection is being set"; $$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$$
$$$$$$$$$
PRINTS TILL HERE ON THE WEB PAGE
my $dbh=DBI->connect($dsn_ora
,$ora_user
name,$ora_
password)
or die "Error : $DBI::errstr\n";
if($DBI::err){
print "problem here \n";
}
print "<font color=blue><i>The Connection is set";
my $sth=$dbh->prepare("select
* from user_profile");
$sth->execute() or die "$DBI::errstr \n";
#get data from database
#format for display
print "<center>\n";
print "<table border=1>\n";
print "<TR bgcolor=0000aa>";
print "<TD><font color=yellow><b>First Name</b></font></TD>";
print "<TR>\n";
while(($first)=$sth->fetch
row()){
print "<TR><TD>This si the $first</TD></TR>";
}
#print "$DBI::rows rows affected !\n";
$sth->finish();
$dbh->disconnect();
print "\n</table>";
print "</center>";
print "<br><br><br><hr><br><br>\
n";
print "<font color=red><i>Last update by ";
print "\n</body></html>\n"
##########################
##########
##########
##########
##########
##########
########
Start Free Trial