December 20, 200817 yr Hi - I am trying to get text from mysql to show on a web page with the paragraghs in place, all I am getting is long lines of text. This is the script I'm using to get the last item of text from the db. <?php // USED WITH MAIN PAGE OF WEB SITE TO DISPLAY NOTES $query = "SELECT * FROM notes ORDER BY id DESC LIMIT 0, 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "{$row['notes']} <br>"; } I've tried using nl2br within the code but cannot get it to work. Having looked through 2 books and searched many forums I thought it was time to ask for help. Any help much appreciated Regards Ray Edited February 10, 201016 yr by Sam G added [code] tags
December 20, 200817 yr Hi - I am trying to get text from mysql to show on a web page with the paragraghs in place, all I am getting is long lines of text. This is the script I'm using to get the last item of text from the db. <?php // USED WITH MAIN PAGE OF WEB SITE TO DISPLAY NOTES $query = "SELECT * FROM notes ORDER BY id DESC LIMIT 0, 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "{$row['notes']} <br>"; } I've tried using nl2br within the code but cannot get it to work. Having looked through 2 books and searched many forums I thought it was time to ask for help. Any help much appreciated Regards Ray Are you using phpmyadmin, if so you can cheat a little, if you have the field called notes that you are calling, you can format the text in the database using <br> and <p> tags. this is ideal if it is you only entering the info in the database. Pat Edited February 10, 201016 yr by Sam G added [code] tags
December 20, 200817 yr Author Are you using phpmyadmin, if so you can cheat a little, if you have the field called notes that you are calling, you can format the text in the database using <br> and <p> tags. this is ideal if it is you only entering the info in the database. Pat Yes I am using phpmyadmin but other people will also be entering info in and they will not know the tags to use. Thanks Pat Ray
December 20, 200817 yr Yes I am using phpmyadmin but other people will also be entering info in and they will not know the tags to use. Thanks Pat Ray Hi can you add an editor to the admin page http://www.fckeditor.net/
December 21, 200817 yr Author Hi can you add an editor to the admin page http://www.fckeditor.net/ Thanks for that tip - being a novice at this game it took me a few goes to get it running correctly but it seems to work just as I wanted. Thanks again for your help. Ray
Create an account or sign in to comment