# Miscellaneous > Database Programming >  Why won't that line feed???

## MuSQLe

Helo, ACK...

I have a peculiar problem concerning the linefeed string in PHP 4.3.0.
Every time I use \n it just won't work. In all the other scripts like PHPmyAdmin they work. Something is wrong with my notation, I guess (what else should it be?...)

Example:

' echo "This is a linefeed test.\nThis should be the next line, but it isn't!"; '

What am I doing wrong???

----------


## sboerner

First of all, sorry for my english!

What are you trying to achieve with this linefeed.

Because you spoke about PHPMyAdmin, I think you want a linefeed on your webpage. \n only makes a linefeed in the html source code but not on the page itself. If you want a linefeed on your page you have to write something like this:

echo "This is a linefeed test.<br>\nThis is the next line!";

--> this will create HTML Source like this
This is a linefeed test.<br>
This is the next line!

--> and output on the page like this
This is a linefeed test.
This is the next line!

another example
echo "This is a linefeed test.<br>This is the next line!";

-->HTML Source
This is a linefeed test.<br>This is the next line!

-->BROWSER OUTPUT
This is a linefeed test.
This is the next line!

last example
echo "This is a linefeed test.\n This is NOT the next line!";

-->HTML Source
This is a linefeed test.
This is NOT the next line!

-->BROWSER OUTPUT
This is a linefeed test. This is NOT the next line!

I hope I've understand your question in the right way.

Greetings,
Stefan

----------


## MuSQLe

Das Problem war der HTML output.
Ich habe zwischenzeitlich auch gemerkt, dass ich nur mit dem <br>-TAG den Zeilenvorschub erzwingen kann... Frage mich nur wozu dann der C string \n gut ist!?

----------


## greenman

Couple of possibilities:

1) You're displaying on a browser, so you need to use <br> instead of \n.

2) You're not running on a Unix system. Newlines on the various Operating Systems are:
Macintosh: \r 
Unix     :  \n 
Windows  :  \r\n

----------


## sboerner

> _Originally posted by MuSQLe_ 
> *Das Problem war der HTML output.
> Ich habe zwischenzeitlich auch gemerkt, dass ich nur mit dem <br>-TAG den Zeilenvorschub erzwingen kann... Frage mich nur wozu dann der C string \n gut ist!?*


Der erzeugt Dir einen Zeilenumbruch innerhalb des HTML "Quellcodes", was aber nicht mit einem Umbruch (<br>) auf der Seite selbst (beim ansehen im Browser) zu verwechseln ist. (siehe nochmal obige Beispiele)

----------


## MuSQLe

OK, I can understand that.
I never payed attention to the linebreaks and the linefeed in the source-code. Now I know, thanks...

----------

