my $statement = "SELECT IP_Adresse FROM table WHERE IP_Adresse = ?;"; my $dbh = DBI->connect("DBI:mysql:$db:$host",$user,$password) or die $DBI::errstr; my $sth = $dbh->prepare($statement); $sth->execute($ENV{REMOTE_ADDR}); if($sth->fetchrow_array()){ print "Du bist gesperrt"; } else{ print "Du darfst weitersurfen"; }