Jump to content

Line breaks on mysql generated text


cactus

Recommended Posts

Hi

 

My problem is that text that is in my database are showing up next to each other in a line rather than on seperate lines, normally I would have just used <br> but as it's generated from my sql I don't know how to do it.

 

<ul id="headlines">

<?php foreach ( $results['articles'] as $article ) { ?>

		<a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a>

<?php } ?>

      </ul>

 

Anyone have any idea? Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/233069-line-breaks-on-mysql-generated-text/
Share on other sites

try wrapping li tags around the anchors

<ul id="headlines">

<?php foreach ( $results['articles'] as $article ) { ?>

		<li><a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a></li>

<?php } ?>

      </ul>

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.