Well, this problem is not limited to apostrophes. It has happened where the variable has a period and paranthases (sic) too. But not every variable with these characters causes it to break, but it only breaks when a non-letter is in the variable. Most records with apostrophes are working fine. I cannot figure out what is is working for some and not others.
Here is a simplified query. Note the FROM section. To get 'Hacksaw' Jim Duggan to appear I need to comment out as follows. Something is causing these INNER JOINS to break with some queries.:
SELECT player
FROM
Events
#INNER JOIN Players ON Players.plID = Events.plID
INNER JOIN Promoters ON Promoters.prID = Events.prID
#INNER JOIN PlayerDetails ON PlayerDetails.plID = Events.plID
#INNER JOIN Sports ON Sports.sportCode = Players.sportCode
INNER JOIN Locations ON Locations.loID = Events.loID
WHERE player = '".$aPlayer."'";
So I don't believe it is a hash/apostrophe issue. I am checking language types on MySQL and my pages but they all appear to match. I manually copied over the prID (and other IDs) from table to table to make sure they all match but still no luck.
I echoed the query and the variable is coming in fine.
How else can I trouble shoot this?