Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: if/else options

by busunsl (Vicar)
on Aug 20, 2009 at 11:37 UTC ( #790065=note: print w/replies, xml ) Need Help??

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);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://790065]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2020-10-28 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (259 votes). Check out past polls.

    Notices?