Reputation: 1180
I have a situation where I have a custom field with this html symbol (‚
). When I try to replace it by an equivalent (,) I just cannot do it...
I'm using this sql
query:
$wpdb->query ("UPDATE $wpdb->postmeta SET `meta_value` = REPLACE(`meta_value`, \'%‚ %\') WHERE `meta_value` LIKE '‚'");
What am I doing wrong?
Upvotes: 1
Views: 84
Reputation: 1180
After search and trying, I manage to do this with this query:
$wpdb->query ("UPDATE $wpdb->postmeta set meta_value = replace(meta_value, '‚', ',') WHERE `meta_key` LIKE 'description'");
Upvotes: 1
Reputation: 494
To convert from ‚ to a comma, use replace like below:
select replace(meta_value, '‚', ',') from your_table where meta_value like ','
shown as select statement for testing, actual update:
update set your_table set meta_value = replace(meta_value, '‚', ',') where meta_value like ','
Upvotes: 1