At 10:09 PM -0300 6/19/01, Juan wrote:
>Hi,
>
>I'm trying to connect MySQL using the following code:
>
>#!/usr/bin/perl -w
>
>use CGI qw(:standard);
>use DBI();
>
>
>print header;
>print start_html("mysql");
>
>print h1("Lista de Medicamentos/Cosméticos");
>
>
>$dbh = DBI->connect("DBI:mysql:fol","fol","passfrr27");
>$sth = $dbh->prepare("SELECT CODE,DESCRIPTION FROM PRODUCT LIMIT 0, 30");
>$sth->execute or die "Error: ".$sth->errstr();
>
>print p("=====================================");
>print p("Number of records: $sth->rows");
>
>while(($cod,$desc) = $sth->fetchrow_array) {
> print "$cod - $desc\n";
>}
>
>$dbh->disconnect;
>
>
>print end_html;
>
>
>PLEASE!! What am I doing wrong???
Is this a request, or a quiz?
You don't perform any error-checking on your connect() call, for
one thing, so you don't know if (or why) it fails. That's your
first step:
$dbh = DBI->connect ( ....)
or die "Connect failed: $DBI::errstr\n";
>
>TIA,
>Juan.
--
Paul DuBois, [EMAIL PROTECTED]