Re: store backslash in mysql database [message #170692 is a reply to message #170689] |
Mon, 15 November 2010 03:08 |
Magno
Messages: 49 Registered: October 2010
Karma:
|
Member |
|
|
On 11/14/2010 08:18 PM, Peter wrote:
> In article<MPG(dot)274a7c95e2d635f19896dc(at)news(dot)virginmedia(dot)com>,
> pete(dot)ivesAll_stRESS(at)blueyonder(dot)co(dot)uk says...
>> In article<4ce02cdd$0$19902$91cee783(at)newsreader03(dot)highway(dot)telekom(dot)at>,
>> usenet(at)helmutchang(dot)at says...
>>> Am 14.11.2010 18:11, schrieb Peter:
>>>
>>>
>>> The bug is not in the part of the encryption script. It is in the part,
>>> where the encrypted data is stored to the database.
>>>
>>>> So, all I could potentially do, as I see it, is include an extra:
>>>>
>>>> if, char converted to backslash, then change to a different char.
>>>
>>> No! Haven't you read the other answers, concerning
>>> <http://www.php.net/manual/en/function.mysql-real-escape-string.php>?
>>>
>>> There are some characters in strings and blobs, that have to be escaped
>>> when used in a (My)SQL query. And it's not only the backslash. This
>>> function does it for you in the correct way! *But*: The escape sequences
>>> are *not* stored in the database. So when you fetch the value again, it
>>> is exactly as you want it.
>>>
>> Sorry, I got a little thrown of the scent here for
>> mysql_real_escape_string when the disagreements started. I've now taken
>> a look at the function and it does seem ideal for my purposes.
>>
>>
>
> Sorry to reply to my own post but...
>
> Having read right to the very end, when they say \n is replaced by '\n'
> litteral, what do they mean? If that means the \n is replaced by a
> completely different MySQL representation of \n, then is it still going
> to work for me?
>
Just use that function and determine by yourself that it works... Don’t
mind the comment by Jerry, he clearly has a confusion about
control-characters in PHP.
|
|
|