PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Saving linebreaks in a TEXT field
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Saving linebreaks in a TEXT field

Réponse
 
LinkBack Outils de la discussion
Vieux 25/10/2007, 02h36   #1
Daniel Kaplan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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....


  Réponse avec citation
Vieux 25/10/2007, 04h21   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
==================

  Réponse avec citation
Vieux 25/10/2007, 04h47   #3
Daniel Kaplan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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


  Réponse avec citation
Vieux 25/10/2007, 09h36   #4
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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"?

  Réponse avec citation
Vieux 25/10/2007, 14h23   #5
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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
==================

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h26.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13373 seconds with 13 queries