Jump to content

[SOLVED] mysql_real_escape_string() and nl2br() problem


shadiadiph

Recommended Posts

I am inserting a message to a database but at the same time sending it by email.

 

the test message i am using is .

 


line's one's

line's two's

 

problem i have is i am using mysql_real_escape_string($message) to insert it to the database.

 

then when i print $message it says line\'s one\'s\r\n\r\nline\'s two\'s

 

then if i use $message= stripslashes($message) then $message= nl2br($message)

 

it returns 'sline's one'srnrnline's two's 

 

it doesn't break the line and prints rnrn???

samshel that kind of works it breaks the lines by doing that but still has the rnrn.

 

darkwater the problem is not inserting it to the datbase it is inserting to the database fine and when i call it it looks fine the problem is in the email that is sent this is where rn is appering before i wasn't using mysql_escape_string and it was working fine but i am told that you have to use it :(

ok guys thatks for the input i solved just had to change the order a bit.

 

$message      = stripslashes($_POST["message"]);
$message2     = ($message);
$message      = mysql_real_escape_string($message);

 

then insert $message to the database

 

then

 

$message2     = nl2br($message2);

 

before insering $message2 into the email

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.