Greets Folks,

I am trying to get an online database set up and running, but I keep getting 
error messages at login.

Here are two sample scripts I have been running (both are from Paul DuBois' 
book MySQL and Perl for the Web).

###### SCRIPT 1 ######

#! /usr/bin/perl -w
# intro4.pl - generate a Web page using the CGI.pm object-based interface

use strict;
use CGI;
my $cgi = new CGI;
print $cgi->header (),
$cgi->start_html ("My Page Title"),
$cgi->p ("My page body"),
$cgi->end_html ();
exit (0);

###### SCRIPT 2 ######

#! /usr/bin/perl -w
# intro6.pl - connect to MySQL, retrieve data, write plain text output
use strict;
use DBI;
use CGI qw(:standard);

my ($dbh, $sth, $count);
$dbh = DBI->connect ("DBI:mysql:host=localhost;database=*******",
                     "******", "*******", {PrintError => 0, RaiseError => 1});
$sth = $dbh->prepare ("SELECT name, wins, losses FROM teams");
$sth->execute ();
$count = 0;
while (my @val = $sth->fetchrow_array ())
{
     print p (sprintf ("name = %s, wins = %d, losses = %d\n",
     $val[0], $val[1], $val[2]));
     ++$count;
}
print "$count rows total\n";
$sth->finish ();
$dbh->disconnect ();
exit (0);

I have double checked everything. CGI.pm works withother scripts.  Thwe 
server I know for a fact has MySQL on it, DBI and DBD::mysql.  the fiedls 
have been uploaded in ASCII format, and I've CHMOD-ed them to 755.

I can't tell what else could be wrong.  The only thing I can think of might 
be the login command.  I had to block out the real user names and passwords 
and stuff with asterisks here, but the username and password I use are for 
the DBA, an I am assuming that that user has read/write permissions.  The 
only other thing I can think of might be that the line 
DBI:mysql:host=localhost might be different on the actual system than in the 
book.  Do any of these things sound possible?  If so, how can I correct them 
or get the right info?

Thanks,

Will





_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to