I have done a code in PHP to insert data into MySql in malayalam. When I insert data, It becomes English in database.. I have set charset to utf-8 in my code and in data base utf8 general_ci..please anyone give answer..thanks in advance
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can give this simple code
SELECT * FROM dictionary WHERE malayalam = 'ആകാശം'
This code will work fine in phpmysql,also you can refer this link
Press this link for your clarification
回答2:
Don't forget to set charset as utf8
in META tag
<meta charset="utf-8">
For More
And in mysql as
mysql_set_charset('utf8');
Then you can insert in to db as,
INSERT INTO tableName (name) VALUES ('രാകേഷ്');
回答3:
1) Add the code beginning of the php page
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2) Make sure your database & tables are on Collation utf8_general_ci
3) Use the database connection code: $conn = new mysqli($server, $user, $password, $database); $conn->set_charset("utf8");
4) Then try insert query and retrieve query using $conn handler, ie: $q_newspage="SELECT * FROM news GROUP BY id DESC LIMIT 8"; $qresult_newspage=$conn->query("$q_newspage");
Thanks