So how do you handle that problem and other special/problematic characters?
do you have to use phpmyadmin? any chance you could use another front end tool?
What other choices would I have?
(Originally I wrote the articles in OO Write, pasted them in NetBeans, and then added the HTML. But now that I am converting all of my physical articles to MySQL records, I need a way to get thinsg into my database. More so, moving forward I’ll still need a way to get data in MySQL.)
i paste raw html including text with aprostrophes into heidisql all the time, and it takes care of escaping the apostrophes for you
I am using “MediumText”.
Is this a database issue? Or a data-type issue? Or do I need to clean things up in PHP?
when you provide a value to be inserted into a string datatype (varchar, text, mediumtext, whatever), the string value needs to be enclosed in apostrophes
each apostrophe that is embedded in your string value must be escaped
the standard sql way of doing it is to code two consecutive apostrophes for each occurrence
INSERT
INTO person ( ... surname ... )
VALUES ( ... 'O''Toole' ... )
you can try doing this with a text editor, but i wouldn’t be surprised if phpmyadmin actually had an option for it, although i can’t really help you with that as i don’t use it myself
each apostrophe that is embedded in your string value must be escaped
the standard sql way of doing it is to code two consecutive apostrophes for each occurrence
INSERT
INTO person ( ... surname ... )
VALUES ( ... 'O''Toole' ... )
you can try doing this with a text editor, but i wouldn’t be surprised if phpmyadmin actually had an option for it, although i can’t really help you with that as i don’t use it myself
What if I use a backslash (\) ??
And if I do that, then how do I get rid of the escaping character when I display the article in my web page using PHP?!
As I said before, I composed the articles in OO Write, pasted them into NetBeans, marked up the text, and wha-la… working php articles.
So now I am copying and pasting the marked up articles frome ach respective php file into phpMyAdmin so they are in my database.
I tried manually adding a backslash before each apostrophe, and it seems to work, BUT that is a alot of work AND I now have backslashes showing in my web page?!