List Info

Thread: note 66890 added to function.mysql-real-escape-string




note 66890 added to function.mysql-real-escape-string
user name
2006-05-31 15:05:07
I had a problem with newline-characters ("\\n"
& "\\r") being converted to their literal
representation ('\\n' & '\\r') giving unwanted
output after fields were converted. To solve this problem I
simply replace the literals again after conversion:

<?
// ...
$field = mysql_real_escape_string($field);
$field = str_replace('\\r', "\\r",
$field);
$field = str_replace('\\n', "\\n",
$field);

$query = "INSERT INTO foo (bar) VALUES
('".$field."'");
mysql_query($query);
?>

Greetz,
Sébastien Jacobs
http://www.spiritual-c
oder.com
----
Server IP: 216.194.113.175
Probable Submitter: 80.201.8.187
----
X-Spam-Status: No, hits=3.1 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER 
	autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mysql-re
al-escape-string.php
Edit        -- http://master.p
hp.net/note/edit/66890
Del: integrated  -- ht
tp://master.php.net/note/delete/66890/integrated
Del: useless     -- http:
//master.php.net/note/delete/66890/useless
Del: bad code    -- http
://master.php.net/note/delete/66890/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/66890/spam
Del: non-english -- h
ttp://master.php.net/note/delete/66890/non-english
Del: in docs     -- http:
//master.php.net/note/delete/66890/in+docs
Del: other reasons-- http://master
.php.net/note/delete/66890
Reject      -- http://master
.php.net/note/reject/66890
Search      -- http://ma
ster.php.net/manage/user-notes.php

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

note 66890 deleted from function.mysql-real-escape-string by nlopess
user name
2006-05-31 17:35:35
Note Submitter: spiritual-coder at spiritual-coder dot com 

----

I had a problem with newline-characters ("\\n"
& "\\r") being converted to their literal
representation ('\\n' & '\\r') giving unwanted
output after fields were converted. To solve this problem I
simply replace the literals again after conversion:

<?
// ...
$field = mysql_real_escape_string($field);
$field = str_replace('\\r', "\\r",
$field);
$field = str_replace('\\n', "\\n",
$field);

$query = "INSERT INTO foo (bar) VALUES
('".$field."'");
mysql_query($query);
?>

Greetz,
Sébastien Jacobs
http://www.spiritual-c
oder.com

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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )