note 85233 added to function.mysql-real-escape-string

From: Date: Thu, 21 Aug 2008 12:54:09 +0000
Subject: note 85233 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-143707@lists.php.net to get a copy of this message
mysql_real_escape_string function replace every new line and carriage return (Invisible \n and \r) to literal \n and \r (visible). I think this must be documented. For Example [code] mysql_connect("localhost","root",""); $FirstStr=<<< here This is first line This is second line here; $EscapedStr=mysql_real_escape_string($FirstStr); print "Before :"; var_dump($FirstStr); print "After :"; var_dump($EscapedStr); [/code] Output was : Before :string(40) "This is first line This is second line " After :string(42) "This is first line \nThis is second line\n" I used str_replace to replace them with actual new line and carriage return characters. ---- Server IP: 203.199.69.133 Probable Submitter: 203.122.11.35 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php Edit -- https://master.php.net/note/edit/85233 Del: integrated -- https://master.php.net/note/delete/85233/integrated Del: useless -- https://master.php.net/note/delete/85233/useless Del: bad code -- https://master.php.net/note/delete/85233/bad+code Del: spam -- https://master.php.net/note/delete/85233/spam Del: non-english -- https://master.php.net/note/delete/85233/non-english Del: in docs -- https://master.php.net/note/delete/85233/in+docs Del: other reasons-- https://master.php.net/note/delete/85233 Reject -- https://master.php.net/note/reject/85233 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143707) next »