Store and query Arabic characters in mysql using PHP

I want to create a table in mysql db which will be populated and quieried using PHP form or HTML, this table will have 2 columns one is English, and the other is Arabic, can someone tell me how to do so please?
Ashraf-HassanAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
fiboConnect With a Mentor Commented:
You have several problems to solve.

0 - I strongly recommand that you print http://www.sitepoint.com/blogs/2004/05/18/understanding-unicode/ and keep the copy handy.

1 - Select UTF8 as your character code. This implies that all your html and php files are encoded using utf8 with no BOM.
Be sure that your php scripts output html code with an explicit mention to utf8

2 - Check that this works fine with non-arabic characters, including accented latin characters such as é à etc

You will then know for sure that all of this is OK for latin chars, and that you have no problem with utf8 etc

3 - Using phpmyadmin, select arabic display. Then input arabic text into one field of the database
check that the display back is fine

You will then know for sure that you can enter and display back arabic chars

4 - Create a simple php script (in utf8 of course) that will read the table and display both the latin and arabic field. You will probably need to do some CSS to format the text as rtl for arabic and ltr for latin.


The item list I suggest will have only one problem at a time, so that you can solve it one after the other. More importantly, keep your php script to debug any problem you might find later.

Nothing really difficult, it is just that there are many layers of parameters that make this complex.
0
 
Ashraf-HassanAuthor Commented:
Thank you I have managed to create a mysql table with utf8
0
 
fiboCommented:
B-) Glad to know it is now solved. Thx for the grade and points.
0
All Courses

From novice to tech pro — start learning today.