Using the mysql select statement, you receive a specific value and try to sprinkle this value on php, but it appears like this.

Asked 2 years ago, Updated 2 years ago, 41 views

    $query2 = mysql_query("select namemuseums from museums where idmuseums like '$permission%'");
    mysql_query("set names utf8");
    $row2 = mysql_fetch_row($query2);
    $museumname = $row2[0];
    echo($museumname);

When executing the top query statement, only one value appears, for example, 'a'. By the way, I tried to display the result value in php, but was it an encoding error?It pops up like this How do I solve it?

mysql php

2022-09-22 20:33

1 Answers

Add the code below at the top of the php~

<?php header('Content-Type: text/html; charset=UTF-8'); ?>

It is recommended to set the default character set to utf8 for apache, php, and mysql.

How to change the character set


2022-09-22 20:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.