Searching for People Who Have Apostrophes in Their Names
There are many thousands of people in the database who have apostrophes in their surnames (and a few with apostrophes in their first names, but not many of those). Examples are Irish names such as O'Donohue and also some Italian and French names that begin with L' or La'.
I knew there were some quirks in the way the MySQL database system deals with apostrophes, but I only figured out around the middle of 2020 that trying to search on people names that had apostrophes just didn't work unless you did some fancy footwork. At the time I noted it in the Release Notes (for release 1.05) I thought that you could use an underscore in place of the apostrophe when doing a search and that would return the people who had apostrophes in their names (in addition to other characters, but let's not go there). I was pretty sure at the time I tested it using the underscore and it worked, but I just tried it again recently and it doesn't work now.
As an aside, something might have changed in MySQL, but it's more likely that I changed some of my php search code and that I accidentally broke using the underscore to search for those records. In any event, that's neither here nor there. I'm not going to go hunting through my code if that's the case. I found another way to search for the records with apostrophes in them, and here's how.
Wherever you are searching for a character with an apostrophe, instead of the apostrophe insert a percent sign ( % ) as a wildcard, then follow it with two (2) apostrophes with no space between them, then follow the apostrophes with a second percent sign.
This example will return all names with an apostrophe anywhere in the name:
%''%
This will bring up everyone whose name begins with a D followed by an apostrophe:
d%''%
And this will bring up everyone whose name begins with an O followed by an apostrophe:
O%''%
If you want to be more specific (let's say you want O'Connor) you could enter it like this:
O%''Connor
If you are searching for a specific name like that you don't need the trailing percent sign. You only need that if you are searching for any name with an apostrophe followed by a partial name, such as:
O%''Con%
To return O'Conners or O'Connors or O'Coners.
BTW, it won't do any harm to leave the trailing percent sign, unless it is returning more results than you want, in which case you can dispense with it if you know the name you're looking for is an exact match for the string you entered.
I'd like to come up with a programmatic fix for this but until I do so you're just going to have to use these tricks to find people with apostrophes in their names.
Return to Release Notes Page
Return to main People Search Screen