Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

\r\n db saving and echo issue

Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic