is addslashes() really needed?
hi all.. do you really need addslashes() to store data into mysql?
Because I tried this:
$item = "jim's";
$item = addslashes($item);
if I echo $item then $item is "jim\'s" then I store $item into mysql database table.
But when I retrieve it using SELECT, even if I don't use stripslashes(), the result is "jim's" NOT "jim\'s". So what do I use the addslashes() for in the first place? :confused:
thanks
Re: is addslashes() really needed?
try using double addslashes. in linux "\" is used to "escape some character" to not being interpreted as special ones. so the "\" die in the process. if you want:
"jim\'s" stored
i think it should lok like:
$item = "jim\\\'s" (\ to escape \ and \ to escape ')
try it and tell me. becouse i didn“t tested. just a heartbit.
edited one minute later
OK i tryed it. it works. :wave: