Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Format text from mysql

Featured Replies

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 by Sam G
added [code] tags

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 by Sam G
added [code] tags

  • 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

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/

  • 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 :D

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.