开发者

An interesting issue about mysql_real_escpae_string

I have simple form for editting site content: - a text input for title - a textarea for content

When adding content, there is n开发者_高级运维o problem, allthings add normally:

$chead      = mysql_real_escape_string(stripslashes($_POST['chead']));
$ctext      = mysql_real_escape_string(stripslashes($_POST['ctext']));

But when edittig the article that containig the

$chead = 'sdsfsf' "sdgsdgs"ggdsfsdg

The $chead = 'sdsfsf' and the "sdgsdgs"ggdsfsdg will be lost!!! What is the problem with mysql_real_escpae_string? Thanks


You need to track down where the information is getting lost, which isn't likely to be mysql_real_escape_string.

Check the $chead value that's being generated (before you accuse a particular function of having damaged your data, make sure it is). Then check SQL command you're generating and make sure it's working. Check the database after you insert/update the record and the values returned from the database when you ask for the article back.

In my experience it's much more likely to be a programmer error in the database interaction, or HTML generation that's causing trouble than PHP. If you really do track the problem down to mysql_real_escape_string, you'll probably need to reinstall PHP and MySQL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜