李 冰 wrote:
> I writed a perl script as below, but it can't work well with apache.
> when i use web-broswer to visit it, there is nothing display. can
> someone tell me why?
>
> #!/usr/bin/perl
>
> print "Content-type: text/html\n\n";
The above line is what pops out at me. I believe each of those '\n' needs to be '\r\n'.
> use DBI;
> $dbh=DBI->connect("dbi:Oracle:demo", "lb1", "libing71")
> or die "Can't connect: $DBI::errstr\n";
Are you sure that it's actually connection to the database? Check your Apache error
log to
see if there are any message relating to your script.
> print "<html><body><h1>Customer table</h1>";
>
> $sth=$dbh->prepare("SELECT firstname, address FROM df1.customer");
> $sth->execute();
>
> print "<table>\n";
> print "<tr><th>Customer Name </th><th>Customer
> Address</th></tr>\n";
> while ( @row = $sth->fetchrow_array)
> {
> print "<tr>";
> foreach (@row)
> {
> print "<td>$_</td>";
> }
> print "</tr>\n" }
> print "</table>\n";
>
> print "</body></html>";
>
> $sth->finish;
>
> $dbh->disconnect;
--
Andrew Gaffney
Network Administrator
Skyline Aeronautics, LLC.
636-357-1548
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>