in reply to DBI and MySQL wild card function?
Also, look into the RaiseError attribute and you can avoid having to explicitly print out errstr(). update: added RaiseError attribute to code. Oh yeah ... select * is bad news, especially when using fetchrow_hashref ... you should always spell out the names of the columns you want returned.use strict; use DBI; my $dbh = DBI->connect( 'DBI:mysql:CLTE', {RaiseError=>1} ); my $sql = " SELECT * FROM clttable WHERE clt LIKE ? "; my $sth = $dbh->prepare($sql); $sth->execute($INPUT{clt} . '%'); my $row = $sth->fetchrow_hashref; $sth->finish; $dbh->disconnect;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: DBI and MySQL wild card function?
by BUU (Prior) on Oct 02, 2002 at 03:13 UTC | |
by diotalevi (Canon) on Oct 02, 2002 at 03:44 UTC | |
by jeffa (Bishop) on Oct 02, 2002 at 05:51 UTC | |
by diotalevi (Canon) on Oct 02, 2002 at 06:33 UTC | |
by Anonymous Monk on Oct 02, 2002 at 11:51 UTC | |
by diotalevi (Canon) on Oct 02, 2002 at 15:45 UTC |