Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Louisville, KY

    News System(Problem Viewing News)

    Okay so i created a news system, were i can psot news on my site and others can view it, but there is a problem. I will give you an example first.

    Form Box (Begining)

    Welcome to the site.

    Enjoy your stay!

    Form Box (End)

    So I post that and it inserts it into my Mysql database. But, when i go to view it on my site it will show up like this.

    News Show (Begin)

    Welcome to the site. Enjoy your stay!

    News Show (End)

    Why did it not put in the line space, it just puts them together. So i go check my mysql table and in the table it inserted the space. But, when it come out on the site there is no space. Why?

    If this helps to show the news i use this code.

    include "db.php";
    $query="SELECT * FROM site_news ORDER BY id DESC LIMIT 8";
    while ($i < $num) {
    //I changed below just to give you an idea, it is really a bunch over tables to give the right look
    echo $title;
    echo "<br>"
    echo $text;

    Help Please!!

  2. #2
    It sounds like you need to enter the text into the form box as html. Separate lines with a <br> and it should display correctly.

  3. #3
    Join Date
    Feb 2005
    Louisville, KY
    I dont not understand???

  4. #4
    When you do the 'echo $text', the browser is interpreting it as html. Since there is no <br> in the contents of the $text variable, it's displaying it all on one line.

    When you type the data into your form, it needs to look like this:

    Welcome to the site.<br>
    Enjoy your stay!

  5. #5
    Join Date
    Jul 2003
    You need to do this.

    echo nl2br($text)
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

Posting Permissions

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