Hi all:
I am sending a perl program I am trying to run which
doesn't connect to the database. The error message is
at the bottom of the e-mail. I think the program is
going to the sock file and not TCP/IP and I don't know
how to change this, but I'm not sure whether this is
the error, so any help is much appreciated.
Happy holidays.
MVS.
#!/usr/bin/perl -w
package DBD::mysqlPP;
use CGI':standard','-noDebug';
#feo4.pl
my @row;
$event=($row[0]);
$location=($row[1]);
$time=param($row[2]);
$price=param($row[3]);
$description=param($row[4]);
$contact=param($row[5]);
$day=param($row[6]);
use DBI;
my $dbh= DBI->connect ('DBI:mysqlPP:myd', 'umvs',
'umvs') ||die "Could not connect to database:
".DBI->errstr;
print "hello";
my $sth = $dbh->prepare($sql)
or die "Can't prepare $sql: $dbh->errstr\n";
my $sql="INSERT INTO event VALUES ('$location',
'$time', '$description', '$price', '$day', '$event',
'$contact')";
$sth->execute();
if (my $sth->SQL($sql)){
print "SQL failed";
exit();
}
#my @row;
while(@row = my $sth->fetchrow_array()) {
print
qw($row[0]\t$row[1]\t$row[2]\n\t$row[3]\n\t$row[4]\n\t$row[5]\n\t$row[6]\n);
}
$sth->close();
$sth->finish();
$dbh->disconnect();
--------------------------------------------
This is the error message I get when I compile the
program:
DBI->connect(myd) failed: Couldn't connect to
/tmp/mysql.sock: at C:/Perl/site/
lib/DBD/mysqlPP.pm line 109
at feo4.pl line 19
Could not connect to database: Couldn't connect to
/tmp/mysql.sock: at C:/Perl/
site/lib/DBD/mysqlPP.pm line 109
(in cleanup) Can't call method "close" on an
undefined value at C:/Perl/
site/lib/DBD/mysqlPP.pm line 274.
Thanks again.
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php