Help for this page

Select Code to Download


  1. or download this
    use constant COLUMNS => [qw(Consign ISBN Price Title Author Subject)];
    
    my $regex = join '|', @{COLUMNS()};
    
    my ($search) = $q->param('search') =~ /^${regex}$/;
    die 'Bad search criteria' unless defined $search;
    
  2. or download this
    my $statement = qq{
      SELECT *
        FROM onshelf
    ...
    
    my $sth = $dbh->prepare($statement);
    $sth->execute("%$criteria%");
    
  3. or download this
    $sth->bind_columns(\my($consign, $isbn, $price, $title, $author, $subject));