How To Manage International Languages In MySQL Database


1
Listing Type
List Category
Tutorials
Location
Bur Dubai
Last update
how to display and Storing multilingual records in the MySQL database using PHP code.

Store and retrieve Unicode characters with MySQL using PHP


1. How to store Unicode characters in a database
2. How php can store/retrieve Unicode characters to and from Mysql database
3. How Indian languages like Telugu or Hindi or Tamil can be stored in database.
4. Your database encoding/collation should be utf8_general_ci. this option select at the time of creating Table fields.
( we can set this option also in PHPMyAdmin. Go to table structure and change collation latin1_swedish_ci to utf8_general_ci )

example:-1

CREATE TABLE tablename
(
id INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
title VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
description text CHARACTER SET utf8 collate utf8_general_ci
) ENGINE = MYISAM ;
5.Before inserting data use mysql_set_charset('utf8') function.

example:-2

mysql_set_charset('utf8');

mysql_query("INSERT INTO .....");

?>

6.To retrieve data :- use this code

example:-3 (  Data Display Page )


mysql_set_charset('utf8');
mysql_query("SELECT * FROM ....");
?>

Note: You should use utf8_general_ci instead of utf8_unicode_ci

What's the difference between utf8_general_ci and utf8_unicode_ci :-


utf8_unicode_ci uses the Unicode Collation Algorithm as defined in the Unicode standards, whereas utf8_general_ci is a more simple sort order which results in "less accurate" sorting results.


utf8_general_ci is faster at comparisons and sorting, because it takes a bunch of performance-related shortcuts.
utf8_unicode_ci, which uses the Unicode rules for sorting and comparison.

Distance Education In Dubai
Dubai, United Arab Emirates

9966416345
REPLY TO THIS CLASSIFIED
3 + 4 =