Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save Data in Arabic in MySQL database

I have changed the charset of the tables and of the column, i get the arabic text as ???? marks in MYSQL database

here is the design of the table

  CREATE DATABASE mydb   DEFAULT CHARACTER SET utf8   DEFAULT COLLATE utf8_general_ci;      CREATE TABLE `categories` (                            `category_id` tinyint(2) NOT NULL auto_increment,               `category_name` varchar(50)character set utf8 NOT NULL ,      PRIMARY KEY  (`category_id`)       insert into `mydb`.`categories`      (`category_id`, `category_name`)     values (1,'کتگوری');    commit; 

When I again fire select query it shows ???? as text?

Can anyone tell me where am i doing wrong?

like image 789
Romani Avatar asked Jul 28 '11 12:07

Romani


People also ask

How do I get MySQL to accept Arabic?

To read ,write and sort Arabic text in mysql database using php correctly, make sure that: MySQL charset: UTF-8 Unicode (utf8) MySQL connection collation: utf8_general_ci. your database and table collations are set to: utf8_general_ci or utf8_unicode_ci.

Can we save file in MySQL?

In general, the contents of a file are stored under Clob (TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT) datatype in MySQL database. JDBC provides support for the Clob datatype, to store the contents of a file in to a table in a database.

How can I store Hindi data in MySQL?

1) Choose utf8 character set and utf8_general_ci collation. 2) Whenever you want to save and retrieve the data you need to set the characterset as follows. //To set the char set mysql_set_charset('utf8'); //To select hindi data mysql_query("SELECT * FROM ...."); // To insert hindi data mysql_query("INSERT INTO ....");

How to insert Arabic data in SQL Server?

First you check either your database , table and column name is utf8 set or not. If these are not set to utf8 then first you set it then you may insert arabic data into you db table. YOU MAY CHECK EACH OF THESE BY LOOKING BELOW EXAMPLE. SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "schemaname";

How to insert Arabic data manually in phpMyAdmin?

To insert Arabic Data manually into your Phpmyadmin. First you check either your database , table and column name is utf8 set or not. If these are not set to utf8 then first you set it then you may insert arabic data into you db table. YOU MAY CHECK EACH OF THESE BY LOOKING BELOW EXAMPLE.

How to read and sort Arabic text in MySQL using PHP?

To read ,write and sort Arabic text in mysql database using php correctly, make sure that: mysql_query ("SET NAMES 'utf8'"); mysql_query ('SET CHARACTER SET utf8'); Don't use the deprecated mysql_query; switch to mysqli or PDO.

How to store Arabic string in Oracle?

Iti is easy to store Arabic string in Oracle. Use this code: declare @P_CUSTOMER_NAME nchar(50) set @P_CUSTOMER_NAME2=N'أختبار' The above will save in Oracle just fine. Share Follow edited May 21 '12 at 11:09 Perception 76.7k1919 gold badges173173 silver badges187187 bronze badges answered May 21 '12 at 8:29 AkramAkram 9 1 3


1 Answers

To insert Arabic Data manually into your Phpmyadmin.

First you check either your database , table and column name is utf8 set or not. If these are not set to utf8 then first you set it then you may insert arabic data into you db table.

YOU MAY CHECK EACH OF THESE BY LOOKING BELOW EXAMPLE.

For Database:

SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "schemaname"; 

For Tables:

SELECT CCSA.character_set_name FROM information_schema.`TABLES` T,        information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA WHERE CCSA.collation_name = T.table_collation   AND T.table_schema = "schemaname"   AND T.table_name = "tablename"; 

For Columns:

SELECT character_set_name FROM information_schema.`COLUMNS` C WHERE table_schema = "schemaname"   AND table_name = "tablename"   AND column_name = "columnname"; 

You may easily set utf8 to your tables if you are using SQLYog.

Just right click on db, table, column name and click on alter option and set to

Database Chartset = utf8 Database Collation = utf8_general_ci .

Just Enjoy ....

like image 173
Muhammad Rizwan Kaim Khani Avatar answered Sep 27 '22 18:09

Muhammad Rizwan Kaim Khani