Re: Content Feed
| From: | Marek Kilimajer | Date: | Mon, 21 Oct 2002 15:43:55 +0000 |
| Subject: | Re: Content Feed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120753@lists.php.net to get a copy of this message | ||
str_replace(' ',' ',nl2br($row[2])) should help you.
php@erars.demon.co.uk wrote:
I have developed my own content feed in that you enter an article from somewhere which is posted into a mysql database and then anyone with access to it can use a java call to the feed and have the neadlines of the the most recent news articles displayed on their web site. When you click on a headline it refers to an ID in the news table and a new window is opened and the article is displayed but without any formatting at all. When an article is entered people may press enter to separate paragraphs etc and would like to know how to get these spaces to be reciprocated when the article is displayed as currently it ommits the breaks. This is the code which I currently have in place: <?php mysql_connect ("localhost", "root","testhouse"); mysql_select_db ("content"); $result = mysql_query ("select * FROM articles WHERE articleId='$articleId'"); while ($row = mysql_fetch_row($result)) { printf ("<tr><td>%s</td></tr>",$row[2]);} ?> I presume I need to insert something in the printf section, although it might be something to do with the code that inserts it into the database not being able to handle breaks. Any help and direction would be much appreciated. thanks JCook