开发者

Inserting email headers into mysql field quotes and slashes issue

I am trying to insert email headers read from impap in to a mysql text field. Problem is the headers are full of slashes, commas, quotes, line feeds. mysql_escape doesnt come near it. Th开发者_C百科e different mail server responses can lead to quite different headers. Do i have to do some weird voodoo before storage?


mysql_real_escape_string() should really be all you need:

mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.

are you working with multiple connections? If you are, be sure to add $link_identifier to the call, as defined in the manual.


Use prepared statements instead of building the query using strings.

See for example here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜