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
https://forums.phpfreaks.com/topic/33848-dumb-2/#findComment-158995
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
https://forums.phpfreaks.com/topic/33848-dumb-2/#findComment-159035
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.