Page 1 of 1
Saving paragraphs
Posted: Sat Feb 20, 2010 10:55 pm
by crazymao
i want to enter paragraphs into my database and then be able to retrieve them in the same format, aka:
string 1
string 2
string 3
and not:
string1 string2 string3 which is what my current setup does. i have researched and could not find anything relevant to my situation. this is urgent to the progress of my website so any and all help will be greatly appreciated. thanks in advance
Re: Saving paragraphs
Posted: Sun Feb 21, 2010 4:15 am
by VladSun
And your current code is ...?
Re: Saving paragraphs
Posted: Sun Feb 21, 2010 5:01 am
by Eran
Re: Saving paragraphs
Posted: Sun Feb 21, 2010 3:09 pm
by crazymao
thanks but the message inserted into the database comes from a user input aka from an textarea so is there a way to employ this method on that text?
Re: Saving paragraphs
Posted: Sun Feb 21, 2010 3:12 pm
by Eran
yes. it doesn't matter where the text came from..
Re: Saving paragraphs
Posted: Sun Feb 21, 2010 4:27 pm
by crazymao
pytrin wrote:yes. it doesn't matter where the text came from..
thanks, do you mind writing me a script that would do that to $string
Re: Saving paragraphs
Posted: Mon Feb 22, 2010 12:36 pm
by pickle
I'm gonna go out on a limb & say: Yes, yes he does. The function documentation has examples you can look at and learn from.
Re: Saving paragraphs
Posted: Mon Feb 22, 2010 1:12 pm
by John Cartwright
crazymao wrote:
thanks but the message inserted into the database comes from a user input aka from an textarea so is there a way to employ this method on that text?
Save the text unmodified to the database, and as suggested, apply nl2br() when outputting the data.