Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
if (defined $status) { $statement = $dbh->prepare('SELECT COUNT(*) FROM name WHERE status + = "' . "$status" . '"') or die DBI->errstr; } else { $statement = $dbh->prepare('SELECT COUNT(*) FROM name WHERE age = +"4"') or die DBI->errstr; $status = 'OPEN'; } $sth = $dbh->prepare($statement) or die print "Couldn't prepare st +atement: $DBI::errstr; stopped"; $sth->execute() or die print "Couldn't execute statement: $DBI::er +rstr; stopped"; my $count = $sth->fetchrow_array(); $sth->finish;
Couldn't execute statement: You have an error in your SQL syntax near +'DBI::st=HASH(0x8298e60)' at line 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MySQL Error
by Hero Zzyzzx (Curate) on Nov 20, 2001 at 08:25 UTC | |
by Anonymous Monk on Nov 20, 2001 at 08:37 UTC | |
| |
|
Re: MySQL Error
by thunders (Priest) on Nov 20, 2001 at 19:36 UTC | |
by Caillte (Friar) on Nov 20, 2001 at 21:29 UTC |