Jump to content

mysql_real_escape_string breaking \n


Nolongerused3921

Recommended Posts

Well I'm one step closer, I found this on php.net:
[quote]
Note that mysql_real_escape_string doesn't prepend backslashes to \x00, \n, \r, and and \x1a as mentionned in the documentation, but actually replaces the character with a MySQL acceptable representation for queries (e.g. \n is replaced with the '\n' litteral). (\, ', and " are escaped as documented) This doesn't change how you should use this function, but I think it's good to know.
[/quote]


Now to figure out how to convert that into real \n... Anyone know how? I'm not having any luck on php.net
Link to comment
Share on other sites

Since the moderators found it necassary to delete my new thread, and I am unable to edit this thread... I need someone to edit the title and content to reflect this new problem that has surfaced....

Title: Need to fix Mysql_real_escape_string's \n to work with nl2br
Content:
I am having a bit of a problem with mysql_real_escap_string, it seems it converts \n and the like to special mysql safe strings that php doesn't read correctly, and I need to figure out how to convert these back to something PHP understands so nl2br isn't broken.

[quote]
Note that mysql_real_escape_string doesn't prepend backslashes to \x00, \n, \r, and and \x1a as mentionned in the documentation, but actually replaces the character with a MySQL acceptable representation for queries (e.g. \n is replaced with the '\n' litteral). (\, ', and " are escaped as documented) This doesn't change how you should use this function, but I think it's good to know.
[/quote]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.