Help for this page

Select Code to Download


  1. or download this
    my @where;
    my $sql = 'select * from table';
    ...
    push @where, 'column3 = "' . $var3 . '" ' if defined $var3;
    
    $sql = $sql . ' where ' . join(' and ', @where);
    
  2. or download this
    my @values = (undef, $var1, $var2, $var3);
    my @where;
    ...
    }
    
    $sql = $sql . ' where ' . join(' and ', @where);