Saving paragraphs

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
crazymao
Forum Newbie
Posts: 14
Joined: Sun Aug 02, 2009 1:56 pm

Saving paragraphs

Post 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
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Saving paragraphs

Post by VladSun »

And your current code is ...?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Saving paragraphs

Post by Eran »

Last edited by pickle on Mon Feb 22, 2010 12:22 pm, edited 1 time in total.
Reason: Fixed function spelling
crazymao
Forum Newbie
Posts: 14
Joined: Sun Aug 02, 2009 1:56 pm

Re: Saving paragraphs

Post 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?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Saving paragraphs

Post by Eran »

yes. it doesn't matter where the text came from..
crazymao
Forum Newbie
Posts: 14
Joined: Sun Aug 02, 2009 1:56 pm

Re: Saving paragraphs

Post 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
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Saving paragraphs

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Saving paragraphs

Post 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.
Post Reply