Forum Moderators: open

Message Too Old, No Replies

quote punctuation in html text in mySQL TEXT field

whether to use #034; or \" in TEXT field

         

knonymouse

8:41 pm on May 2, 2009 (gmt 0)

10+ Year Member



I'm starting out with mySQL. A database I've made includes a TEXT field with html code which I filled in from existing web pages. Finding the problem with queries, caused by the single quotes and double quotes, I subsequently changed them to #039; and #034. I now let a PHP script read the text and substitute the quote marks back again.

Would there be a reason to instead store \' and \" in the text field?

coopster

10:41 pm on May 2, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Yes, print versions. Or, anything non-web related.

I prefer to store the values "as is" and render the output for the intended delivery, i.e. an html document. You can use escape characters to prepare the data for INSERT and UPDATE in the database table(s).

phranque

6:54 am on May 4, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



this WebmasterWorld thread has some links that may have useful information for you:MySQL/PHP - dealing with quotes and special characters [webmasterworld.com]