|
-
Apr 25th, 2006, 07:53 AM
#1
Thread Starter
Frenzied Member
New Line in Code
I have a loop that brings some data down from a MySQL database, but it adds the code on the same line, right next to each other
Is there a way of dropping a line in the code within each loop
Thanks, ILMV
-
Apr 25th, 2006, 07:56 AM
#2
New Member
Re: New Line in Code
yes!
Where you want the line to break add ."\n"; to the end of your string.
Failing that try ."<br />";
-
Apr 25th, 2006, 08:14 AM
#3
Thread Starter
Frenzied Member
Re: New Line in Code
Worked great, i had seen that used before, never knew what it was.
great work
-
Apr 25th, 2006, 08:17 AM
#4
New Member
Re: New Line in Code
No prob!
Obv. the more line breaks you want just keep adding \n\n etc within the quote ("") marks.
-
Apr 25th, 2006, 08:49 AM
#5
Re: New Line in Code
How you implement a new line is completely dependent on the content type of the file being outputted. If you do not specify a content type by default, text/html is assumed which means you must serve a proper HTML document. If you just want to show raw data use the content type text/plain which saves you having to construct an HTML document. To make a line break in a text/plain document use the sequence "\r\n" (CR+LF) for maximum browser compatability.
To specify content type, call the header() function before starting any output.
PHP Code:
header('Content-type: text/plain; charset: utf-8');
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|