How to manage international languages in MySQL database
Mysql 13-Feb-2019

How to manage international languages in MySQL database

If you are making a web site where multiple languages used like Arabic, French, Hindi or Urdu then your MySQL database default settings is not valid to do that to insert all languages in database. If you insert data in your database and database is not configured as I am going to show you in this tutorial then your data will be look like ????? and you lost your data.

So now i am going to tell you how to configure database to accept international languages.

Very important HTML settings you have to add a meta for character set UTF-8

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Now create table in your database its default character set will be latin1_swedish_ci

PHPGang Character Set

You have to change it to utf8_general_ci

PHPGang Character Set 2

Here is the insert query

mysqli_query($connection,"INSERT INTO `comments`(id,comment) values (N'$id',N'$comment')");

N’$id’ N is stands for national regional language character set.

Fetch code and query

<?php 
include('db.php'); 
mysqli_query($connection,"set character_set_results='utf8'"); 
---- code --- 
?>