if ($parent eq "Father") { $sub_parent = "Mother"; $sth = $dbh->prepare ("select Father from Roster where User = ?); $sth->execute($user) or die $sth->errstr; # putting 'or die $sth->errstr;' will tell you if # your query fails and why $name = $sth->fetchrow_array; } #end if Father