列出时显示重音

jvidinwx  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(307)

我在php中有一个select框,它从mysql检索数据,但是带有重音符号的数据用特殊字符显示。在我添加选择框之前,一切都很好。我该怎么修?
这是我的密码:

<html>
    <head>
    <meta charset="utf-8">
        <!-- importer le fichier de style -->
        <link rel="stylesheet" href="Style/style1.css" media="screen" type="text/css" />
        <title>Ajouter un Scanner </title>
        <body>
        <div id="container">
            <!-- zone de connexion -->

            <form   action ="insert.php" method="post">
                <h1>Ajout d'un Scanner</h1>
                <label><b>Catégorie</b></label><br>
                <?php
                $mysqli = new mysqli("localhost", "root", "", "mapbdd") or die($this->mysqli->error);
                $query = $mysqli->query("SELECT icone_categorie FROM markers_icone");
                //$result = mysqli_query($query);
                ?>
                <select name="select_categorie" id='select_categorie'type="List" >
                  <option value="-1"></option>
                <?php
                while($row =  $query->fetch_array(MYSQLI_ASSOC)){
                  echo "<option>{$row['icone_categorie']}</option>";
                }
                ?>
                </select>
                <br><br>
                <label><b>Ville</b></label>
                <input type="text" placeholder="Entrer la ville" name="fville" required>

                <label><b>Longitude</b></label>
                <input type="text" placeholder="Entrer la longitude" name="flong" required>

                <label><b>Latitude</b></label>
                <input type="text" placeholder="Entrer la latitude" name="flat" required>

                <label><b>Description</b></label>
                <input type="text" placeholder="Description" name="fdesc" required>

                <input type="submit" id='submit' value='Insérer' >

            </form>
        </div>

    </body>
    </head>

谢谢您

7hiiyaii

7hiiyaii1#

尝试插入此

$mysqli->set_charset("utf8");

在这行之后:

$mysqli = new mysqli("localhost", "root", "", "mapbdd") or die($this->mysqli->error);

(设置mysqli连接的字符集)

相关问题