php - MySQL update text field with '

I need to be able to have a charvar field that contains an apostrophe like Woody's. I'm using wp_list_table to

I need to be able to have a charvar field that contains an apostrophe like Woody's. I'm using wp_list_table to simplify the editing of the table. After making the update, the field contains Woody/'s. I can update the data using phpMyAdmin by using Woody''s. Thought that before the data is sent to wp_list_table I could change it to Woody''s, but that ends up in the database as Woody/'/'s. How do I accomplish this?

I need to be able to have a charvar field that contains an apostrophe like Woody's. I'm using wp_list_table to simplify the editing of the table. After making the update, the field contains Woody/'s. I can update the data using phpMyAdmin by using Woody''s. Thought that before the data is sent to wp_list_table I could change it to Woody''s, but that ends up in the database as Woody/'/'s. How do I accomplish this?

Share Improve this question asked Sep 9, 2019 at 16:56 BudBud 438 bronze badges 1
  • There's no code in your question, can you edit it to include code? – Tom J Nowell Commented Sep 9, 2019 at 17:13
Add a comment  | 

1 Answer 1

Reset to default -1

Apparently someplace in the wp_list_table, or maybe someplace else, the escape character \ was inserted before any ' . I was able to solve this by adding this line of code just before the $wpdb->update statement.

$item['RecordedSubdivision'] = str_replace("\'", "'",$item['RecordedSubdivision']);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745172188a4614994.html

相关推荐

  • php - MySQL update text field with '

    I need to be able to have a charvar field that contains an apostrophe like Woody's. I'm using wp_list_table to

    6小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信