unicode databse

Salam


i want one help from u
we are creating small application in urdu using php/mysql

we defined page like

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

and our database collation is utf8_unicode_ci, we used

ALTER DATABASE `fatawa` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci

and table collation is utf8_unicode_ci, we used

ALTER TABLE `book` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci

even the fields are utf8_unicode_ci, we used

ALTER TABLE `book` CHANGE `b_name` `b_name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL

but when we store some urdu value like بسم اللہ

it becomes in database like this .....مت٠رقات

yes when we fire select query from our webpage it looks fine like بسم اللہ
but when we see database from php my admin it shows مت٠رقات

can you solve the problem or give me sample of single page which we can use for our application

May allah bless you.
 

زیک

مسافر
When you connect to the database in your php code, send the following query:

کوڈ:
SET NAMES UTF8;

That should fix your problem.​
 

نبیل

تکنیکی معاون
کوڈ میں جہاں جہاں mysql_connect فنکشن استعمال ہو رہا ہے، اس کے فوراً بعد SET NAMES UTF8; کا استعمال کریں۔ مثال کے طور پر ذیل کا کوڈ دیکھیں:

[SYNTAX="php"]$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_query('SET NAMES utf8', $conn);[/SYNTAX]
 
Top