Reputation:
I have a listing of names, that I want to store in mysql as a serialized array (for caching purposes). Some names contain apostrophes, and for some reason won't un-serliaze properly. There is no output.
Upvotes: 1
Views: 1999
Reputation: 342655
Use mysql_real_escape_string
on the serialized string prior to inserting into the database.
You could handle storing serialized data bybase64_encode
ing it prior to inserting it in the database, and base64_decode
ing it upon retrieval, but with proper escaping that is unnecessary.
Upvotes: 6