Hi,

There should be a message in the error log telling you what went wrong.  If
not, you may have to change the connection call to

  my $dbh = DBI->connect("DBI:mysql:database=lps;host=localhost","", "",
  {'RaiseError' => 1}) or die $DBI::errstr;

That's always a good idea anyway (but perhaps setting RaiseError does
the same thing?).

My guess is that it's attempting to connect as the user you've got
Apache set up to run under.


[EMAIL PROTECTED] (allan) wrote:
>hi
>
>i have now finally installed the mysql server and the mysql driver.
>
>when i run the script (chmod'ed 777) below in the terminal i get this
>output (which is correct):
>
>Content-Type: text/html
>
>one
>two
>Found a row: title = xterminator, format = 2lp
>three
>
>
>
>however when i run the scirpt from my browser, where i know perl works
>fine with apache i only get:
>one
>
>
>so my question is how can i get the same output in the brower?
>
>thanks
>allan
>
>
>
>
>______script____________
>
>#!/usr/bin/perl -w
>print "Content-Type: text/html\n\n";
>use strict;
>use DBI();
>print "one\n";
>my $dbh = DBI->connect("DBI:mysql:database=lps;host=localhost","", "",
>{'RaiseError' => 1});
>print "two\n";
>my $sth = $dbh->prepare("SELECT * FROM longplayers");
>$sth->execute();
>while (my $ref = $sth->fetchrow_hashref()) {
>       print "Found a row: title = $ref->{'title'}, format = 
>$ref->{'format'}\n";
>}
>$sth->finish();
>$dbh->disconnect();
>print "three\n";
>

  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to