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
Saving paragraphs
Moderator: General Moderators
Re: Saving paragraphs
And your current code is ...?
There are 10 types of people in this world, those who understand binary and those who don't
Re: Saving paragraphs
Last edited by pickle on Mon Feb 22, 2010 12:22 pm, edited 1 time in total.
Reason: Fixed function spelling
Reason: Fixed function spelling
Re: Saving paragraphs
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?pytrin wrote:ln2br() - http://php.net/manual/en/function.nl2br.php
Re: Saving paragraphs
yes. it doesn't matter where the text came from..
Re: Saving paragraphs
thanks, do you mind writing me a script that would do that to $stringpytrin wrote:yes. it doesn't matter where the text came from..
Re: Saving paragraphs
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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Saving paragraphs
Save the text unmodified to the database, and as suggested, apply nl2br() when outputting the data.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?pytrin wrote:ln2br() - http://php.net/manual/en/function.nl2br.php