It's not a secret anymore!*
The moose likes PHP and the fly likes \r\n db saving and echo issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "\r\n db saving and echo issue" Watch "\r\n db saving and echo issue" New topic
Author

\r\n db saving and echo issue

Kumar Barun
Greenhorn

Joined: Oct 14, 2011
Posts: 20
My problem is that when I save data(large data) from textarea into MySQL db by using $mysqli->real_escape_string($content);, it stores special chars escaped and also \r\n. But when I update the same the same way it does not do that(it is desired).

Second problem is that of the same data being echoed with \r\n on the browser, even nl2br() does not work. I know that even without nl2br(), echo prints data without \r\n except that we do not get <br/>(line breaks).

Below are the codes I've written:



Below code retrieves data to forms if already saved. You can see the problem in above figure.




Below code saves or updates the table:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: \r\n db saving and echo issue
 
Similar Threads
Error while inserting data in database using jsp
insert and update data in jsp using mvc model
recod is not inserting in mysql databse
Getting null values in database while edit.jsp