Jump to content

Dumb #2


phpbeginner

Recommended Posts

Okay, here is my output to the webpage......Can someone help me out a bit please.
[code]<?php
                         
                                                        while($row=mysql_fetch_row($rs))


                            {
                                echo("<p class='pagetitle'><strong>" . $row[1] . "</strong></p>");       
                                                         
                                echo("<p>" . $row[2] . "<br>");
                                echo("<p>" . $row[3] . "<br>");                              }
                                 
                         
                            echo("</p>");
                            ?>
[/code]
Link to comment
Share on other sites

Try this:...

[code]<?php
while($row=mysql_fetch_row($rs)){
  // loop and add <br> tags
  foreach ($row as $k => $v){
      $row[$k] = nl2br($v);
  }

  // echo the output
  echo("<p class='pagetitle'><strong>" . $row[1] . "</strong></p>");       
  echo("<p>" . $row[2] . "<br>");
  echo("<p>" . $row[3] . "<br>");                              }
  echo("</p>");
?>[/code]

Also, as someone suggested nl2br() in a post further up, it's normally customary to investigate the [url=http://uk.php.net/manual/en/function.nl2br.php]manual for that function[/url] and then post your code with what you've attempted based on what you learned from the manual :)

Regards
Huggie
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.