Saving linebreaks in a TEXT field

This is a discussion on Saving linebreaks in a TEXT field within the MySQL Database forums, part of the Database Forums category; So I have my database and I read text from a webpage then put it in a record including a ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-25-2007
Daniel Kaplan
 
Posts: n/a
Default Saving linebreaks in a TEXT field

So I have my database and I read text from a webpage then put it in a record
including a field that is dataype TEXT.

Of course I lose line breaks, so what happens is that the following
sentence:

This is line 1...

.... and this is line 2

becomes "This is line 1... ... and this is line2"

Is there some function I can call in Perl or something else I can do so I
store and keep the format of the text?

Many thanks....


Reply With Quote
  #2 (permalink)  
Old 10-25-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Saving linebreaks in a TEXT field

Daniel Kaplan wrote:
> So I have my database and I read text from a webpage then put it in a record
> including a field that is dataype TEXT.
>
> Of course I lose line breaks, so what happens is that the following
> sentence:
>
> This is line 1...
>
> ... and this is line 2
>
> becomes "This is line 1... ... and this is line2"
>
> Is there some function I can call in Perl or something else I can do so I
> store and keep the format of the text?
>
> Many thanks....
>
>
>


Look at the source for your web page. I suspect your line breaks are
there, and your problem is that HTML ignores them.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
  #3 (permalink)  
Old 10-25-2007
Daniel Kaplan
 
Posts: n/a
Default Re: Saving linebreaks in a TEXT field

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com. ..


> Look at the source for your web page. I suspect your line breaks are
> there, and your problem is that HTML ignores them.



you make a good point, but then it comes to me finding them before i put
them in the DB, then converting them to <P> and <BR>, no?

off the top of your head, do you know what they are in the edit field when i
read it? \n? \r?

thanks


Reply With Quote
  #4 (permalink)  
Old 10-25-2007
Captain Paralytic
 
Posts: n/a
Default Re: Saving linebreaks in a TEXT field

On 25 Oct, 04:47, "Daniel Kaplan" <NoS...@NoSpam.com> wrote:
> "Jerry Stuckle" <jstuck...@attglobal.net> wrote in message
>
> news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com. ..
>
> > Look at the source for your web page. I suspect your line breaks are
> > there, and your problem is that HTML ignores them.

>
> you make a good point, but then it comes to me finding them before i put
> them in the DB, then converting them to <P> and <BR>, no?
>
> off the top of your head, do you know what they are in the edit field when i
> read it? \n? \r?
>
> thanks


Depends, how are you "read[ing your] text from a webpage"?

Reply With Quote
  #5 (permalink)  
Old 10-25-2007
Jerry Stuckle
 
Posts: n/a
Default Re: Saving linebreaks in a TEXT field

Daniel Kaplan wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:vcudnX6Mb7d1lr3anZ2dnUVZ_qHinZ2d@comcast.com. ..
>
>
>> Look at the source for your web page. I suspect your line breaks are
>> there, and your problem is that HTML ignores them.

>
>
> you make a good point, but then it comes to me finding them before i put
> them in the DB, then converting them to <P> and <BR>, no?
>
> off the top of your head, do you know what they are in the edit field when i
> read it? \n? \r?
>
> thanks
>
>
>


Nope, you shouldn't be storing html commands in hour database. What if,
for instance, you decide you need to access it from a non-web based
environment, i.e. a command-line utility to generate some reports?

The formatting should be done after you retrieve the data form the
database, not before.

For the rest, try a programming group for the language you're using.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0