note 20376 rejected from function.mysql-escape-string by sander
| From: | sander@php.net | Date: | Sun, 07 Apr 2002 10:20:30 +0000 |
| Subject: | note 20376 rejected from function.mysql-escape-string by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-28801@lists.php.net to get a copy of this message | ||
sjohnson@fuzzygroup.com:
"If you _correctly_ escape a string before putting it into a MySQL field, then when you
retrieve it, you have to do a string replace to UN_ESCAPE it before displaying it."
In a nutshell, that is not true.
The whole purpose of mysql_escape_string and its ilk is to correctly insert data INTO the database.
The outcome is much the same as escaping a character in a simple PHP string assignment:
$string = 'don\'t unescape me!';
When doing <?php echo $string ?> would display:
don't unescape me!
when output. The mysql_escape_string function tells the database to treat that quote as actual
*data*, not as a field data delimiter.