Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,
Please can you help me?
I have installed wamp server and I work on a project using bootstrap and php, the data which I insert into database is in Persian language,
but when I retrieve my records on web application it shows me it like question marks I don't know what to do pls??

Note:
// Create connection
PHP
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

$sql = "SELECT * FROM tbl";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo "id: " . $row["id"]. " - Name: " . $row["Name"]. "";
    }
} else {
    echo "0 results";
}


What I have tried:

I tried utf8_generial_ci,utf8_unicode_ci and utf8_persian_ci
but I have the same problem.
Posted
Updated 28-Oct-18 23:26pm
v4
Comments
[no name] 29-Oct-18 14:44pm    
The "web app" needs access to the correct fonts. Doesn't matter what the encoding is. If there's no compatible font available, you get "?" or little empty blocks in the higher code ranges.
Member 13779003 31-Oct-18 6:48am    
thank you friends I solved the problem by adding this statement after the connection string.
mysqli_set_charset($conn,"utf8");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900