RE: [PHP-WIN] text formatting in database article
| From: | Mark Hope | Date: | Fri, 12 Oct 2001 16:03:35 +0000 |
| Subject: | RE: [PHP-WIN] text formatting in database article | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9826@lists.php.net to get a copy of this message | ||
Thanks for everybodies replies - we've used the nl2br() function and its
working just fine.
Mark
> ----------------------------------------------------------------------
> -----------------------
> Oliver Robillo replied:
>
> You could try using the replace function of mysql within your query.
> For example:
>
> $res=mysql_query("SELECT REPLACE(paragraph_field,CHAR(10),'</p><p>')
> FROM some_table");
>
> What I do is store the article's body with line breaks after each
> individual paragraph. Then when I pull it out of the database table, I
> convert the line breaks into html paragraphs.
>
------------------------------------------------------------------------
---------------------
> >
> > I am currently creating a website that pulls news articles
> > from a mysql database into a php page. The article is stored
> > as a TEXT function in the database, and is inserted by a
> > single form field. What do I need to do in order for the
> > article to be displayed with the proper paragraph breaks
> > instead of a the continuous text it is now.
>