mablo
12.04.2005, 20:54:21
Czy ktoś mi może powiedzieć czym sie różni addslashes od mysql_escape_string

Bo wg mnie to jest to samo. Ale po co mieli by robić dwa polecenia, które różną sie tylko nazwą
vik-ing
12.04.2005, 21:00:21
You MySQL folks might also want to check out mysql_escape_string().
--------- copied from mysql_escape_string():
If you're wondering what's the difference between mysql_escape_string() and
AddSlashes(), I found this from looking at the source code of MySQL
3.23.32 and php 4.0.6:
- mysql_escape_string calls MySQL's library function of the same name,
which prepends slashes to the following characters: NUL (\x00), \n, \r, \,
', " and \x1a.
- AddSlashes escapes NUL, ', " and \.
While mysql_escape_string seems safer, my experience shows that escaping
strings with AddSlashes (which is also done automatically if
magic_quotes_gpc is on) is sufficient, so it seems you can pick whichever
you wish.
Zrodlo : php.net
pozatym lepiej uzyc mysql_real_escape_string()