Fabbuccino Posted September 18, 2009 Share Posted September 18, 2009 Hey Kinda new to mySQL. I have, in a table, a long piece of text with quotation marks, apostrophes, and new lines. When I echo that piece of text into a php page, the new lines are ignored and the text is just one big block of text and the apostrophes are ignored. Why so? I've tried using "htmlspecialchar" when echoing..no luck. any clue as to why this is happening? Quote Link to comment https://forums.phpfreaks.com/topic/174725-special-characters/ Share on other sites More sharing options...
DavidAM Posted September 18, 2009 Share Posted September 18, 2009 New lines are ignored in HTML. You will have to use nl2br() to convert them to line breaks (<BR>). The htmlspecialchars() should take care of quotes and other special characters. So the command would be echo nl2br(htmlspecialchars($TheString)); Don't switch the two functions around or you'll get the line breaks as clear text. If that does not work. Use the "View Source" command in your browser and take a look at what is being sent. Post that, and some code, and maybe we can help. Quote Link to comment https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-920883 Share on other sites More sharing options...
Fabbuccino Posted September 19, 2009 Author Share Posted September 19, 2009 ok thanks. the new lines worked. now i think what my main issue is the fact that i inserted the piece of text in the mySQL database manually and so when trying to convert it back when echoing, it ain't doing that. now, i was able to fix the single quotes through a program i made with visual basic, lol, but i still have an issue with the three dots like this "..." it doesn't accept that..how come? Quote Link to comment https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-921015 Share on other sites More sharing options...
fenway Posted September 21, 2009 Share Posted September 21, 2009 Ellipses can be funny. Quote Link to comment https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-922577 Share on other sites More sharing options...
BioBob Posted September 22, 2009 Share Posted September 22, 2009 Are you typecasting your variables? PHP might be interepreting your INT as a STRING... Quote Link to comment https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-922641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.