You are here: Re: String variable read from Mysql DB + echo = Newline problem « PHP Programming Language « IT news, forums, messages
Re: String variable read from Mysql DB + echo = Newline problem

Posted by weirdstuff on 03/20/06 13:06

Errr, what? :)

Ok I had figured that a backslash was being added when I read the
string from DB, but all my attempts of correcting that have failed.
What we have here is a case where knowing how the output is formatted
_exactly_ is very important. So it would be nice to be able to
"manually" format stuff like newlines and breaks.

Now, your suggestions:

>So, what you have to do is change your formatting characters. Replace
>"\\n" with "\n" and "\\r" with "\r", for instance.

The string already has single backslash in the database. If I add
another "just for fun" I just get two in the output. If I then do a
stripslashes() on one or the other then that doesn't help either.

>Or, alternatively, put the actual characters themselves in the database.

Thats exactly what I'm trying not to do.
So we can agree that the problem is when I am getting the string from
the database. Then PHP (or MySQL?) does some funkyness to the string
variable which makes PHP think that \n means it should print
"backslash" and "en"

Jolly good show. Now lets fix it! :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация