SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    USA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    nl2b problems - newbie

    PHP isn't reading the paragraphs in mySQL. All text of the article is in one big paragraph. I am trying to use nl2b() to make the output read the separate paragarphs. Here is my coding for the segent I want to be put into paragraphs...

    -------------------------------------------
    <FONT SIZE="-1" FACE="Arial,Helvetica,Geneva,Sans-serif,sans-serif">
    <?php

    $db = mysql_connect("localhost", "--", "--");

    mysql_select_db("--",$db);

    $result = mysql_query("SELECT * FROM articles WHERE id=$id",$db);

    printf("%s<br>\n", mysql_result($result,0,"text"));
    ?>
    -------------------------------------------

    I'd really appreciate it if someone could show me where to add the nl2br() command to space the output according to the new lines in mySQL. Thanks in advance!

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    echo nl2br(mysql_result($result0'text')); 

  3. #3
    SitePoint Member
    Join Date
    Mar 2004
    Location
    USA
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worked! Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •