在php中将字符串转换为utf8

时间:2016-06-11 16:36:24

标签: php

我尝试将mysql数据库中的文本转换为出现的方式**对于utf8,我使用此查询但不能正常工作。任何帮助!

$conn = mysqli_connect('localhost', 'root', '', 'sarldbcatw');
            mysqli_select_db($conn,'sarldbcatw')or die('Erreur de selection '.mysqli_error());

                $conn->set_charset("utf8");
                $slq = "SELECT Id_pdf, texte_pdf FROM mtbl_mazel_pdf order by Id_pdf";

            $req = mysqli_query($conn,$slq) or die('Erreur SQL !'.$sql.'<br>'.mysqli_error()); 
             while($data = mysqli_fetch_assoc($req))  {

               $texte_pdf=$data['texte_pdf']; 
               $Id_pdf = $data['Id_pdf'];
               $texte_pdf =  html_entity_decode($texte_pdf);
                 $sqlfic = "UPDATE mtbl_mazel_pdf SET texte_pdf='$texte_pdf'  WHERE  Id_pdf =".$Id_pdf;
                 mysqli_query($conn,$sqlfic) or die('Erreur SQL !'.$sqlfic.'<br>'.mysqli_error());

             }

0 个答案:

没有答案