MySQL Server
--
Questions
--
Followers
Top Experts
I tried this to update all the records: but it doesnt work
update MyTable set MyField = Replace(MyField, "'", "'");
but it doesnt work. it says updated 0 records. how do I identify the incorrect apostrophe?
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
update MyTable set MyField = Replace(MyField, "'", "'");
says updated 0 records.
means that either your table has 0 records, or you forgot to show us the WHERE clause you used...
now, what is the character set of the mysql database?
what is the character set of you web pages (phpmyadmin)?
well, can you please clarify:
* does your table have 0 records or not
* does your UPDATE statement have a WHERE clause or not?
>the apostrophe is not being recognized as an apostrophe.
again, the "issue" is for sure at the display, and NOT on the database level.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
I get 92 for the incorrect apostrophe and 27 for the correct one.
I tried this:
update MyTable set MyField= Replace(MyField, char(92), "'") ;
but i get an error
#1270 - Illegal mix of collations (latin1_swedish_ci,IMPLICI
This returns the same error:
update MyTable set MyField= Replace(MyField, char(92), char(27)) ;
fill that in your update query:
http://dev.mysql.com/doc/refman/5.0/en/charset-collate.html
update MyTable set MyField= Replace(MyField , char(92) COLLATE latin1_swedish_ci , "'" COLLATE latin1_swedish_ci ) ;
Well thats whats really confusing is in phpmyadmin it says the field is latin1_swedish_ci but when I do this
update MyTable set MyField= Replace(MyField , char(92) COLLATE latin1_swedish_ci , "'" COLLATE latin1_swedish_ci ) ;
I get this error
#1253 - COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8'

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
#1253 - COLLATION 'latin1_swedish_ci' is not valid for CHARACTER SET 'utf8'
MySQL Server
--
Questions
--
Followers
Top Experts
MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.