Well, he didnt' actually specify which database product he was using...
addSlashes() will also work for most databases that allow (\') escaping of single quotes. Some database require double quoting of single quotes ('') but addSlashes won't do that for you.
Chris