Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a problem in retrieving data from mysql table using php, it's appears as question marks but in the phpMyAdmin it's appears ok.

please see the following images:
Image 1
Image 2

What I have tried:

function getData() {
$result = $this->con->query("SELECT * FROM Comments");
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "

" . $row["Guest"] . ": " . $row["Txt"] . "

";
}
} else {
echo "No Rows Found";
}
}

The charset in my php source as follows:
<meta charset="UTF-8" />
Posted
Updated 27-Jun-16 8:07am
Comments
Sergey Alexandrovich Kryukov 26-Jun-16 16:32pm
   
And what is the data type do you use for your Arabic text? I hope it's Unicode compatible.
—SA
Ma'd Saeed 27-Jun-16 13:56pm
   
Column datatype is TEXT, it's okay in phpMyAdmin, but in the php webpage it shows a question marks!
Sergey Alexandrovich Kryukov 27-Jun-16 14:03pm
   
You should use Unicode-aware data types.
—SA

1 solution

Everything on the Web supports Unicode and UTF; UTF-8 is standard-de-facto. Perso-Arabic script and corresponding Unicode code point range is very popular; it is supported by default by nearly all modern platforms. All you need is not to spoil it. :-)

Your MySQL data type should comply. Please start here: MySQL :: MySQL 5.7 Reference Manual :: 11.1.11 Unicode Support.

—SA
   
Comments
Ma'd Saeed 28-Jun-16 14:03pm
   
I couldn't do it, can you help me to tell me what to do?
Sergey Alexandrovich Kryukov 28-Jun-16 16:06pm
   
Help with what, exactly?
What have you tried so far?
—SA

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