SET NAMES utf8 in MySQL?

前端 未结 8 1413
北海茫月
北海茫月 2020-11-22 11:30

I often see something similar to this below in PHP scripts using MySQL

query(\"SET NAMES utf8\");   

I have never had to do this for any pr

8条回答
  •  执笔经年
    2020-11-22 11:57

    This query should be written before the query which create or update data in the database, this query looks like :

    mysql_query("set names 'utf8'");
    

    Note that you should write the encode which you are using in the header for example if you are using utf-8 you add it like this in the header or it will couse a problem with Internet Explorer

    so your page looks like this

    
        
            page title
               
        
        
            
    
        
    
    

提交回复
热议问题