views:

31

answers:

1
<?php


$sql = mysql_query("SELECT body FROM comments");

while ($r = mysql_fetch_assoc($sql)) {

   $body .= $r['body'];
}
?>


<?php echo $body ?><br />

Can someone explain why it prints out all comments without no space? It prints out all my entries but they are all together. And the <br /> only after the last comment?

Thanks!

A: 

You would need to use the following to append a <br /> after each comment:

$body .= $r['body'].'<br />';
Gumbo
thanks that works but i think i will have to use another approach i wanted to do this to make it easier for a designer