in reply to Re: Re: Re: DBI::mysql fetch() without execute() PROBLEM
in thread DBI::mysql fetch() without execute() PROBLEM
#!/usr/bin/perl -w use strict; use DBI; use CGI::Carp qw(fatalsToBrowser); use CGI qw (:standard); print "Content-type: text/html\n\n"; my $dbh = DBI->connect(qq{DBI:mysql:database=subscriptions;host=l +ocalhost,I DON'T HAVE A USERNAME AND PASSWORD OTHER THAN ROOT}, {Rais +eError => 1} ); my $sth = $dbh->prepare( q{SELECT email FROM contacts WHERE state + = ?} ); $sth->execute('OH') or die $sth->errstr; while (my @result = $sth->fetchrow_array()) { print "@result\n"; } # check for problems which may have terminated the fetch early die $sth->errstr if $sth->err; $dbh->disconnect;
Can't call method "prepare" on an undefined value at /usr/local/etc/ht +tpd/cgi-bin/DBI_mysql_01.pl line 12.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: DBI::mysql fetch() without execute() PROBLEM
by cfreak (Chaplain) on Jan 23, 2002 at 00:32 UTC | |
by peppiv (Curate) on Jan 23, 2002 at 21:37 UTC | |
by cfreak (Chaplain) on Jan 24, 2002 at 00:40 UTC |