views:

25

answers:

1

I am building an application based on the Zend Framework, and my issue is that whenever I grab data from the database (from inside the respective model class) using the fetchAll() method, despite the fact that \n characters are stored in the database for the string I'm trying to fetch, when I output the variable to the view script, there are no carriage returns/newline charcaters.

Say the string stored in the db reads "Ok, so apparently zend_db does the escaping on it''s own, let''s see:\n\n1. Hey\n\n2. Does\n\n3. This\n\n4. Work?", when I use fetchAll to grab this data and then output it to the view script, there are no newlines, the \n's are replaced by spaces, so I get:

  1. Hey 2. Does 3. This 4. Work?

Instead of the desired:

  1. Hey

  2. Does

  3. This

  4. Work

Can someone explain to me how I can get the desired input given the way the data is stored in the db?

Thanks

+1  A: 

Use nl2br() on the data it will convert the \n to <br /> This question is identical to this one wich I answered the same way.

Iznogood
Wow, I'm dumb. Thanks for the quick response!Also, sorry about a repeated question, I did search, but my phrasing was completely different so I didn't find the other question.
machinemessiah
No one's dumb we all forget stuff! Thanks for accepting my answer.
Iznogood