开发者

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_encodeing it prior to inserting it in the database, and base64_decodeing it upon retrieval, but with proper escaping that is unnecessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜