I have a mysql table with a text field containing German text with German quotes. E.g. „Freda“.
If I read the database directly via php the result is correct. But when I generate a shortcode in wordpress that contains the same php query of the database, the german quotes disappear. All other characters are displayed.
For this reason i want to change the german quotation marks in the DBfield to ‘„’ ‘“’.
With the following command I can replace the quotes with the entity ‘„’ or ‘“’ using phpmyadmin:
UPDATE `TableName` SET `fieldname` = REPLACE(`fieldname`, '„', '„') WHERE `fieldname` LIKE '%„%' COLLATE utf8mb4_bin
But when I want to do this directly using php, I can’t manage it. I can change other characters or words but nothing happens with the quotes. How must the command be formulated in the php file so that I can change it?
I was trying the following codes // as given me from phpmyadmin:
$sql = "UPDATE `TableName` SET `fieldname` = REPLACE(`fieldname`, '„', '„') WHERE `fieldname` LIKE '%„%' COLLATE utf8mb4_bin";
$sqlRes = mysqli_query( $db, $sql );
I changed it to:
$sql = "UPDATE `TableName` SET `fieldname` = REPLACE(`fieldname`, '„', '„') WHERE `fieldname` LIKE '%„%' COLLATE utf8mb4_bin";
$sqlRes = mysqli_query( $db, $sql );
I changed it to:
$sql = "UPDATE TableName SET fieldname = REPLACE(fieldname, '„', '„') WHERE fieldname LIKE '%„%' COLLATE utf8mb4_bin";
$sqlRes = mysqli_query( $db, $sql );
I changed it to:
$sql = "UPDATE TableName SET fieldname = REPLACE(fieldname, '„', '„') WHERE fieldname LIKE '%„%' COLLATE utf8mb4_bin";
$sqlRes = mysqli_query( $db, $sql );
But all of this is not working.