I'm having trouble getting php's mcrypt function to encrypt text in a way that can be stored in my mysql database.
Here's an example of a query that doesn't work:
UPDATE mydatabase.clients SET firstname='\'å»”é¶Q' WHERE id_client=65
But if I change it to be:
UPDATE mydatabase.clients SET firstname='Test' WHERE id_client=65
Then it works. So it must be those crazy mcrypt characters throwing things off.
What do I do to my mysql database so it accepts those characters?
The output of a cipher is a string of bytes, not characters. You shouldn't store cipher text directly as text. Use a "binary" data type, or transform the byte string to text with something like Base-64.