Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Retrive text from database problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Retrive text from database problem

Postby minhantun » Thu Apr 03, 2014 6:45 pm

Hello,

I type some text is textarea and saved in the db. Typed text are

"Hello <- enter
I am PHP Developer <- enter
Nice to meet you all"

when I view saved text in db, I saw db saved as above as I typed.

However when I retrieve text from db and display at text area, it did not appear as
"Hello
I am PHP Developer
Nice to meet you all"


it appeared as "Hello I am PHP Developer Nice to meet you all".


How can I retrieve text as I typed???
Help me guys
minhantun
New php-forum User
New php-forum User
 
Posts: 2
Joined: Sat Mar 29, 2014 9:20 pm

Re: Retrive text from database problem

Postby seandisanti » Thu Apr 03, 2014 9:05 pm

Without seeing your code for how you're storing or retrieving it, we have to guess at what's going on. If you're saving it as multiple fields, then looping through and echoing them, you'll just need to add in line breaks before your echos, or inline between your values.
Code: Select all
echo $row['value1'] . "\n" $row['value2'] . "\n" $row['value3'];
 

for example. If you're storing it all into one field, you should make sure that the character sets being stored and displayed include carriage returns / new line characters. Showing your code will help others give you better answers tailored to your exact situation
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.