Now i m getting this problam
root@Ubuntu-Server:/var/www/corporate/cgi-bin# ./scriptfTesting.cgi
Name "main::hostname" used only once: possible typo at ./scriptfTesting.cgi line 50.
Name "main:
assword" used only once: possible typo at ./scriptfTesting.cgi line 54.
Name "main:
w" used only once: possible typo at ./scriptfTesting.cgi line 41.
Name "main:
ort" used only once: possible typo at ./scriptfTesting.cgi line 50.
Name "main::connect" used only once: possible typo at ./scriptfTesting.cgi line 58.
Name "main::host" used only once: possible typo at ./scriptfTesting.cgi line 40.
Name "main::dbh" used only once: possible typo at ./scriptfTesting.cgi line 54.
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Thu Jun 28 00:56:15 2012 GMT
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Content-type: text/html
<html>
<head>
<title>Corporate User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#0099ff">
Use of uninitialized value $hostname in concatenation (.) or string at ./scriptfTesting.cgi line 50.
Use of uninitialized value $port in concatenation (.) or string at ./scriptfTesting.cgi line 50.
Can't locate object method "connect" via package "DBI" (perhaps you forgot to load "DBI"?) at ./scriptfTesting.cgi line 54.
root@Ubuntu-Server:/var/www/corporate/cgi-bin#
____________________________________________________________________________________________________ _____________________
This is perl script
#! /usr/bin/perl -w
#use strict;
#use DBI;
#use Mysql::Statement;
#use strict;
#use warnings;
use DBI ;
#my @ary = DBI->available_drivers();
#print join("\n", @ary), "\n";
#use DBI;
#use Mysql;
# Print out the web page
print "Expires: Mon, 26 Jul 1997 05:00:00 GMT\n"; # Date in the past
print "Last-Modified: " . scalar gmtime() . " GMT\n"; # always modified
print "Cache-Control: no-cache, must-revalidate\n"; # HTTP/1.1
print "Pragma: no-cache\n"; # HTTP/1.0
print "Content-type: text/html\n\n";
#print "'$FORM{EngineerName}'";
print <<EOHTML;
<html>
<head>
<title>Corporate User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#0099ff">
EOHTML
if (1) {
#####################################################
# Set up variables
$database = "mydb"; # database to connect to
$user = "root";
$host = "127.0.0.1"; # host
$pw = "XXXXXX";
#####################################################
}
# PERL MYSQL CONNECT()
###$connect = mysql->connect($host, $database, $user, $pw);
###my $dbh =mysql->connect($host, $database, $user, $pw);
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port" ;
# SELECT DB
###$connect->selectdb($database);
$dbh = DBI->connect($dsn, $user, $password) ;
$myquery = "select Date,CompanyName,IPAddress,SubnetMask,EngineerName from Corporate"; #where EngineerName= '$FORM{EngineerName}' order by Date";
$execute = $connect->query($myquery);
print <<EOHTML;
<hr>
<br><font face="Tahoma" size="3"><b><u>Check Corporate User Information</u></b></font></br><hr>
<table border=1 bgcolor="#ADFF2F" cellpadding=5 width=90%>
<tr>
<th>Date</th><th>CompanyName</th><th>IPAddress</th><th>SubnetMask</th><th>EngineerName</th>
</tr>
EOHTML
while (@data = $execute->fetchrow_array()) {
print ("<tr>\n");
print ("<td><font face=tahoma size=2>".($data[0])."</font></td>\n");
print ("<td><font face=tahoma size=2>".($data[1])."</font></td>\n");
print ("<td><font face=tahoma size=2>".($data[2])."</font></td>\n");
print ("<td><font face=tahoma size=2>".($data[3])."</font></td>\n");
print ("<td><font face=tahoma size=2>".($data[4])."</font></td>\n");
print ("</tr>\n");
}
print <<EOHTML;
</table>
<hr>
<br>
</font>
</td>
</tr>
<tr><td valign=top>
</font>
</td>
</tr>
</tr>
<tr><td valign=top>
<font>
</font>
</td>
</tr>
</table>
<hr>
</center>
EOHTML
print <<EOHTML;
</body>
</html>
EOHTML
____________________________________________________________________________________________________ _______________________________
Quote:
Originally Posted by kakaka
If I use code with this pattern:
Code:
use DBI ;
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port" ;
$dbh = DBI->connect($dsn, $user, $password) ;
of course with the generalities replaced with specifics, but then comment out the "use" line,
I get the message:
so maybe you left out a "use"?
|