in reply to escape characters for dbi

Use SQL placeholders and you won't have to worry about it:
$sth = $dbh->prepare("SELECT SUM(number) FROM $serverTable where name += ?"); $sth->execute("O'Connor");
This will also improve performance if you run the query more than once, since it doesn't need to be re-prepared each time.