How to make MySQL handle UTF-8 properly

前端 未结 14 2831
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:38

One of the responses to a question I asked yesterday suggested that I should make sure my database can handle UTF-8 characters correctly. How I can do this with MySQL?

14条回答
  •  梦谈多话
    2020-11-22 07:05

    DATABASE CONNECTION TO UTF-8

    $connect = mysql_connect('$localhost','$username','$password') or die(mysql_error());
    mysql_set_charset('utf8',$connect);
    mysql_select_db('$database_name','$connect') or die(mysql_error());
    

提交回复
热议问题