in reply to OT - Searching databases effectively
How about something like...
Insert comments and error handling, and this should be much cleaner.my $joiner = $select_any ? ' or ' : ' and '; my $where = join $joiner, ('bodytext like ?') x @terms; $where .= " order by id desc"; my @terms = map { "%$_%" } @terms; my $sth = $db->prepare("$querystr $where"); $query->execute(@terms);
Disclaimer: my SQL-fu is weak, too :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OT - Searching databases effectively
by skx (Parson) on Mar 30, 2005 at 04:54 UTC |