Craig Hopson Posted May 10, 2012 Share Posted May 10, 2012 Hi all, not shore where to start with this one... SQL Table Entry `comments`This is a test line 1This is a test line 2This is a test line 3 The code echo $row['comments'] The outputThis is a test line 1 This is a test line 2 This is a test line 3 how do i display the output like its stored in the SQL RequiredThis is a test line 1This is a test line 2This is a test line 3 1 Link to comment Share on other sites More sharing options...
Ingolme Posted May 10, 2012 Share Posted May 10, 2012 Print a line break: In plain text:echo "\r\n";In HTML:echo '<br>' Link to comment Share on other sites More sharing options...
Craig Hopson Posted May 10, 2012 Author Share Posted May 10, 2012 (edited) No I know that but all 3 test lines are the same entry one field in the SQL Edited May 10, 2012 by Craig Hopson Link to comment Share on other sites More sharing options...
justsomeguy Posted May 10, 2012 Share Posted May 10, 2012 http://www.php.net/manual/en/function.nl2br.php Link to comment Share on other sites More sharing options...
Craig Hopson Posted May 10, 2012 Author Share Posted May 10, 2012 thank you how would i remove blank lines please Link to comment Share on other sites More sharing options...
justsomeguy Posted May 10, 2012 Share Posted May 10, 2012 You would either need to use a regular expression or split the text up into an array of lines using explode, loop through it, and remove each item that's blank. http://www.php.net/manual/en/function.explode.phphttp://www.php.net/manual/en/function.implode.phphttp://www.php.net/manual/en/function.preg-replace.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now