php echo doesnt print newlines

Posted by Skun on Stack Overflow See other posts from Stack Overflow or by Skun
Published on 2010-03-21T08:22:48Z Indexed on 2010/03/21 8:31 UTC
Read the original article Hit count: 361

Filed under:
|
|
|
|

Hey !

I started doing a new project in PHP / MySql . The Aim of this project is to manage articles for a magazine that i am the editor of.

So the content of the articles, i decided i would store with the "TEXT" column type of MySql

Now when i retrieve this column and print it with echo, the newlines are not there. Its all on the same line.

$resset = mysql_query("select txt from articles where id = 1");
$row = mysql_fetch_assoc($resset);
$txt = $row['txt'];
echo $txt; //doesnt print it as it is in the database as it was typed (multiline)

Find below, the text as it looks in the database and as it looks when it is echoed

in the databse, it is with new lines

Text as it looks when echod

But within the database, its stored with newlines.

Has anybody else encountered this problem?

Please help me as my project depends on this :|

© Stack Overflow or respective owner

Related posts about php

Related posts about php5