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
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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.