http://icyarena.com
http://icyarena.com
How to insert bangla or other unicode language into mysql
  Posted by : Color Picker     Date : 05 February       Leave a comment
When a user inserts any unicode language into mysql databse it looks very ugly in mysql but in output there is no problem.This article will help you to fix this error.

Creating a database named 'test'

How to insert bangla or other unicode language into mysql
Click for large image
1
All settings must be like screenshot.
  • The most important thing is to keep Collation Utf8_general_ci.
  • Click on Create button.
How to insert bangla or other unicode language into mysql
Click for large image
2
Now we will create a table named input that have two columns.one is id another is text.
  • Remember that all settings must be like screenshot.
  • Click on save button.

Setup connecton with mysql using collation_connection

How to insert bangla or other unicode language into mysql
Click for large image
1
Copy following code and Paste this code inside your page to connect with mysql.
  • If any user input unicode language,this code will fix your problem.
    <?php
    $db='test';//mysql database
    $dbuser='root';//mysql username
    $dbpass='';//mysql password
    $db_connect = @mysql_connect('localhost',$dbuser,$dbpass) or die('Opps');
    mysql_select_db($db,$db_connect);
    mysql_query('SET CHARACTER SET utf8');
    mysql_query("SET SESSION collation_connection ='utf8_general_ci'");
    ?>
    

Tips

  • You may comment or ask question about this article.Please feel free to contact us.
  • Dont't forget to share this article with your friends.Click here to share.
<
Subscribe to get Latest Update
Other Networks
Related articles
Random articles