I'm working on a project that can be installed on a number of servers. The issue I come across is people can have their server and tables set for different collation. On one server, I an error received was
PDOException: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (utf8_unicode_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation '='
So I thought I fixed it by adding COLLATE utf8_general_ci
to the query. It fixed it there and it worked on my server, but then someone else tried to run it on their server and received
Syntax error or access violation: 1253 COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
Is there anything I can do to my query to make it "just work" without having to worry about MySQL server config? The query is below, and joins a few tables together. I only included the query itself and not the entire chunk of code. It is a prepared statement in PDO.
SELECT t.tid, a.clientid, tt.status, ts.showactive FROM TABLE1 t INNER JOIN TABLE2 a ON t.related_asset = a.id INNER JOIN TABLE3 tt ON tt.tid = t.tid INNER JOIN TABLE4 ts ON ts.title = tt.status WHERE ts.showactive = 1