Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/174725-special-characters/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-920883
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/174725-special-characters/#findComment-921015
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.