开发者

problem with apostrophe

开发者_运维问答

I am using mysql with PHP. I have a problem with inserting the apostrophe value in database. However I use -

$newstring = str_replace("'","'",$string);

OR

$newstring = str_replace("'","''",$string);

but how could I fetch the string as it is?

Thanks.


Use mysql_real_escape_string:

mysql_real_escape_string($string)


you need to escape it, use addslashes() to sanitise it, or better yet, mysql_real_escape_string()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜