Iyad Posted January 26, 2007 Share Posted January 26, 2007 Hi, I have a table like you see bellow written in MySQL. Like usual, I write an insert query code in PHP. When I fill in the table, precisely fill in ‘Content’ field. I use ENTER < to separate line between paragraphs. But when I preview the page, the ENTER < doesn’t appear. The whole paragraphs is join together. Was this topic have ever discussed before?. I hope someone here will help me. Thanks,-Iyad------------------------------------------------------------------------| articel_id | topics | writer | content | date |------------------------------------------------------------------------| 1 | Global warming | Erian | dummy text | 30-12-06 |------------------------------------------------------------------------ Link to comment https://forums.phpfreaks.com/topic/35774-separating-the-paragraphs-question-help-needed/ Share on other sites More sharing options...
hvle Posted January 26, 2007 Share Posted January 26, 2007 hi Iyad,The problem is not the "enter to DB" part. It is the display to html.Your text stored exactly as you typed in the content field. However, when you paste this text into html, browser recognized a new line as a space, so your text look like it is on 1 line.It is very common to use this function to replace all new line with html break:$textToDisplayOnBrowser = nl2br($textRetrievesFromDB); Link to comment https://forums.phpfreaks.com/topic/35774-separating-the-paragraphs-question-help-needed/#findComment-169549 Share on other sites More sharing options...
Iyad Posted January 26, 2007 Author Share Posted January 26, 2007 This is the page code. Where do I put that: $textToDisplayOnBrowser = nl2br($textRetrievesFromDB); <?php require_once('Connections/articles.php'); ?><?phpmysql_select_db($database_articles, $articles);$query_record_articles = "SELECT * FROM article_categories ORDER BY article_id ASC";$record_articles = mysql_query($query_record_articles, $articles) or die(mysql_error());$row_record_articles = mysql_fetch_assoc($record_articles);$totalRows_record_articles = mysql_num_rows($record_articles);?><html><head><title>ARTICLES</title></head><body><p>No. : <?php echo $row_record_articles['article_id']; ?><br> Topics : <?php echo $row_record_articles['topics']; ?><br> Writer : <?php echo $row_record_articles['writer']; ?><br> Content : <?php echo $row_record_articles['content']; ?><br> Date :<?php echo $row_record_articles['date']; ?></p></body></html><?phpmysql_free_result($record_articles);?> Link to comment https://forums.phpfreaks.com/topic/35774-separating-the-paragraphs-question-help-needed/#findComment-169557 Share on other sites More sharing options...
hvle Posted January 26, 2007 Share Posted January 26, 2007 [code]<?php echo $row_record_articles['article_id']; ?>[/code]change to[code]<?php echo nl2br($row_record_articles['article_id']); ?>[/code]you got the idea. Link to comment https://forums.phpfreaks.com/topic/35774-separating-the-paragraphs-question-help-needed/#findComment-169563 Share on other sites More sharing options...
Iyad Posted January 26, 2007 Author Share Posted January 26, 2007 Thanks man, its work. ::) Link to comment https://forums.phpfreaks.com/topic/35774-separating-the-paragraphs-question-help-needed/#findComment-170171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.