Hi, I'm new to the list and had a quick question regarding selection using if statements. It would be much appreciated if anyone could point me in the right direction. I'm new to using Perl with MySQL and was wondering why it will not allow me to do the following: my $dbh = DBI->connect("DBI:mysql:$database:$hostname", $user, $datpassword);
if ($contractor_id eq "") { my $sth = $dbh->prepare(qq{ select blah1, blah2 from contractors where (username = '$username') and (password = '$password') }); } #end if not contractor id else { my $sth = $dbh->prepare(qq{ select blah1, blah2 from ap_contractors where (id = '$contractor_id') }); } #end else $sth->execute(); I know this is probably simple, but I do not know why it does not perform the selection based on my if statements. I've tried selecting stuff using other if statements, and they did not work either. But once I take away the if/else statement, it works fine, but then the problem remains that I need to select different things based on if somethings true (which in the example I gave above, the condition is if $contractor_id has a value or not). Any input would be much appreciated. Thanks, Greg