note 49707 added to function.mysql-escape-string
| From: | codeslinger at compsalot dot com | Date: | Sat, 05 Feb 2005 20:49:57 +0000 |
| Subject: | note 49707 added to function.mysql-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84563@lists.php.net to get a copy of this message | ||
er um... version_compare did not exist prior to 4.1.0
in any case, adding slashes and dealing with magic quotes etc. is a sure recipe for major
headaches.
You can avoid a whole slew of problems by converting your strings to hex (bin2hex) before passing
them to mySQL
mySQL will accept any value in the form of
0xFEAC1234...
It will then automagically convert it back to a string for storage and retrieval while avoiding all
of the zillions of problems with special characters.
I have done this with some very large records and never had a problem.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-escape-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49707
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49707&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49707&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49707&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49707&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49707&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49707&report=yes
Search -- http://master.php.net/manage/user-notes.php