How do you stored a php serialized array in mysql with values that contain apostrophes?
I have a listing of names, that I want to store in mysql as a serialized array (for caching purposes). Some names contain apostrophes开发者_StackOverflow社区, and for some reason won't un-serliaze properly. There is no output.
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.
精彩评论