Mysql turns ' into ’?

后端 未结 3 698
我在风中等你
我在风中等你 2021-01-02 00:31

How can I stop mysql from converting \' into ’ when I do an insert?

i believe it has something to do with charset or something?

3条回答
  •  借酒劲吻你
    2021-01-02 01:22

    This is what I've done, and it worked for me:

    1. First make sure that column containing ' is utf8_general_ci

    2. Then add the mysql_set_charset to your code

      $db=mysql_connect("localhost", $your_username, $your_password);
      mysql_set_charset('utf8',$db);
      mysql_select_db($your_db_name, $db);
      

提交回复
热议问题