David Robley wrote:
It seems that mysql_escape_string and mysql_real_escape_string do
undesirable things to EOL markers - data from textareas escaped with either
of those functions is entered, and retrieved with, the characters /r/n
instead of a true line break.

This snippet of code demonstrates the problem:

<?php
$wibble = "\"This\" and\n'that'";
echo "Before: $wibble<BR>\n";
$wibble1 = addslashes($wibble);
echo "Addslashes: $wibble1<BR>\n";
$wibble2 = mysql_escape_string($wibble);
echo "Escape: $wibble2<BR>\n";
?>

And the output (from Show source) with line breaks exactly as in the source

Before: "This" and
'that'<BR>
Addslashes: \"This\" and
\'that\'<BR>
Escape: \"This\" and\n\'that\'<BR>

Is this a bug, or am I totally missing something?

No, it's not a bug. If you use it in mysql query, mysql server will convert \n to newline character


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to