#ifndef Z_OBJ_WIRE
When I was about t
A large number of
I’ve been working
The present invent
The effect of a 3-
Q: How to prevent
Q: Proving for $E
Introduction {#Sec
Introduction =====

Introduction {#Sec
1. Field of the In
The effect of huma
Q: how to return
Celebrate St. Patr
The influence of n
SALT LAKE CITY — A
It has been sugges
Cochlear implant s
The present invent
Q: Converting to a new line character in php from mySQL I'm trying to convert a string in to a new line in php from a mySQL database I think it is something to do with it being a varchar column and the default is being like this with spaces instead of a /n: I tried doing this: $sql="SELECT id, username, name, status FROM friends WHERE username='$usern'"; $result = $mysqli->query($sql); while($row=$result->fetch_assoc()){ $userinfo=$row["name"]; print $userinfo; } This is the output: I would like it to look like this: Username Username2 Any ideas? A: You can use nl2br to add newlines: $sql="SELECT id, username, name, status FROM friends WHERE username='$usern'"; $result = $mysqli->query($sql); while($row=$result->fetch_assoc()){ $userinfo=$row["name"]; print nl2br($userinfo); } Demo: http://codepad.viper-7.com/g0wZqV A: I did this: $sql="SELECT id, username, name, status FROM friends WHERE username='$usern'"; $result = $mysqli->query($sql); $result = $result->fetch_assoc(); print nl2br($result["name"]); Thanks for the help guys! A: It is not the problem with your database, but with the output, because in your case the php output mode is not set to html. You should add the PHP header for outputting the HTML document and set the proper php mode for instance if you are using the browser $userinfo = nl2br($row["name"]); header('Content-Type: text/html; charset=utf-8'); echo $userinfo; (if you have other file extensions in the userinfo string, change the content type, you can read a complete list here) If you are in the middle of a php document and you need to output an html document, add this: echo ""; echo ""; echo " Hello"; echo ""; echo ""; echo $userinfo; echo ""; echo ""; The output will be like this: Hello

User

User2

(I know I can use PHP to output the HTML directly from the DB, but this will add php elements inside the HTML, which is bad, I believe). If you are in the middle of a php document and you need to output an html document, add this: echo ""; echo ""; echo " Hello"; echo ""; echo ""; echo "

User

User2

"; echo ""; echo ""; The output will be like this: Hello

User

User2

So if you are using a browser you should add a header like this: If you are using a file, change the header at the beginning You can find more information about the use of headers here Note: php headers should be added before the output of anything other than a blank line. otherwise it wont work.