473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Arabic and english character problem with phpmyadmin and MySQL databse

Dear Sir,
i am facing a encoding problem with MySQL data base and phpMyAdmin.
i developed a form . From wher user can insert the Car plate No. to the MySQL database.Both of the php file for inserting and veiwing is encoded in UTF-8 format. suppose i want to insert plate no as . 1 2 3 ص ص ص ص
but i after inserting to the database i see the plate no as 1 2 3 Ù‚ Ù‚ Ù‚ Ù‚ in the database . In Database the plateno field's collation is utf8_unicode_ci.
so can you telll me where is my problem or how can i see the plate no using phpmyadmin as i inserted ?

Regards,
Faruk Chowdhury.
Nov 7 '07 #1
10 12658
jx2
228 100+
Dear Sir,
i am facing a encoding problem with MySQL data base and phpMyAdmin.
i developed a form . From wher user can insert the Car plate No. to the MySQL database.Both of the php file for inserting and veiwing is encoded in UTF-8 format. suppose i want to insert plate no as . 1 2 3 ص ص ص ص
but i after inserting to the database i see the plate no as 1 2 3 Ù‚ Ù‚ Ù‚ Ù‚ in the database . In Database the plateno field's collation is utf8_unicode_ci.
so can you telll me where is my problem or how can i see the plate no using phpmyadmin as i inserted ?

Regards,
Faruk Chowdhury.
what are the language setting in php.ini and whats your deafult server settings ?

have you tried to add:
[php]
//at the begining of your page
header('Content-Type: text/html; charset=utf-8');
[/php]
i used to have similar problem with east european characters
i changed language settings of apache, mysql and php to utf8 and problem disapeared
(remember that phpmyadmin have to be set to the same charset as all of them if not you will see strange results)
basiclly you have to set everything to one charset

regards
jx2
let me know
Nov 8 '07 #2
Dear Sir,
i added the header('Content-Type: text/html; charset=utf-8');
to all of my php files .in httpd.conf the language AddCharset UTF-8 .utf8
added and My Database is also utf8_unicode_ci and field name of the table is also set with utf8_unicode_ci . still i am facing the same problem like as i see that plate no as 4 5 6 9 ã ã ã using phpMyadmin and from view.php file i see that plate no is as 4 5 6 ? ? ? .
so can you help me to solve this problem?

Thanks in Advance.

Regards,
Faruk Chowdhury.
Nov 11 '07 #3
jx2
228 100+
Dear Sir,
i added the header('Content-Type: text/html; charset=utf-8');
to all of my php files .in httpd.conf the language AddCharset UTF-8 .utf8
added and My Database is also utf8_unicode_ci and field name of the table is also set with utf8_unicode_ci . still i am facing the same problem like as i see that plate no as 4 5 6 9 ã ã ã using phpMyadmin and from view.php file i see that plate no is as 4 5 6 ? ? ? .
so can you help me to solve this problem?

Thanks in Advance.

Regards,
Faruk Chowdhury.
have you change charset of phpmyadmin? try manualy change encoding in your browser to utf8
do your browser change encoding?

i HAS TO WORK
:-)
jx2
Nov 11 '07 #4
Dear Sir,
still i am facing the same problem. when i submitted the arabic character to another php file and i use
[code]
$plte_no = $_GET['plate_no1'];
echo "$plate_no";
i see like as this Õ or ? . Both of these files are encoded with utf-8 .
so can you tell me how can i solve this problem? or how to send arabic character from one form to another in php.

Regards,
Faruk Chowdhury.
Nov 12 '07 #5
jx2
228 100+
Dear Sir,
still i am facing the same problem. when i submitted the arabic character to another php file and i use
[code]
$plte_no = $_GET['plate_no1'];
echo "$plate_no";
i see like as this Õ or ? . Both of these files are encoded with utf-8 .
so can you tell me how can i solve this problem? or how to send arabic character from one form to another in php.

Regards,
Faruk Chowdhury.
the problem is GET i think i asume you use forms on your website if so
use method ='post' and $_POST[]

ihope tht helps
let me know

jx2
Nov 12 '07 #6
Dear Sir,
Thanx for your contribution.i solved the problem and it at was at mysql encoding .when i added
these two lines at my.ini file this is working well.
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8

but now i want to use ajax and

i added chracter set=utf-8 to both of my php file. i can't see my arabic characters. so can you tell me the way or code to set character set in javascript file for handling ajax request for sending data to php file .
[code]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

Regards,
Faruk Chowdhury.
Nov 13 '07 #7
jx2
228 100+
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. </head>
  4.  
in many cases i found that meta tag for encoding might be not enought
as i said before is better to use
[php]
header('Content-Type: text/html; charset=utf-8');
/at the beginning of page
[/php]
anyway acording to this article ajax use utf-8 any way so make sure your page really using utf8 encoding

regards
jx2
Nov 15 '07 #8
Hay, Use the following code as a class while creating your database :
1- use database charset as UTF8
2- keep your database collation as : UTF8_unicode_ci

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.     class CRUD {
  3.         var $con; 
  4.         //function to make connection to database
  5.         function connect(){
  6.             $this->con = mysql_connect("localhost","root","password") or die(mysql_error());            
  7.             mysql_query("SET character_set_results=utf8", $this->con);
  8.             mb_language('uni');
  9.             mb_internal_encoding('UTF-8');
  10.             mysql_select_db("madrasa_bssdc",$this->con);
  11.             mysql_query("set names 'utf8'",$this->con);                
  12.             }
  13.  
  14.         //to search in database tables with parameterized query.
  15.         function search($sql){
  16.             $this->connect();
  17.             $result = mysql_query($sql,$this->con);
  18.             if(mysql_num_rows($result) > 0){
  19.                 return true;
  20.                 }
  21.             else {
  22.                 return false;
  23.                 }
  24.         }
  25.  
  26.  
  27.         //function to get the field value from the table specified in the query
  28.         function getValue($sql,$value){
  29.             $this->connect();
  30.             $result = mysql_query($sql,$this->con);
  31.             if(mysql_num_rows($result) > 0) {
  32.                 $row = mysql_fetch_array($result);
  33.                     $value = $row[$value];
  34.                 }
  35.             else {
  36.                     $value = "";
  37.                 }
  38.                 return $value;
  39.             }
  40.  
  41.         //function to insert record to table according to the parametarized query
  42.         function insert($sql){
  43.             $this->connect();
  44.             mysql_query($sql,$this->con);
  45.             if(mysql_affected_rows() > 0){
  46.                 return true;
  47.                 }
  48.             else {
  49.                 return false;
  50.                 }
  51.  
  52.             }
  53.     }
  54.             ?>
Now use the class as in any of your page like this:
---------------------------
Expand|Select|Wrap|Line Numbers
  1. // in your head portion of the page keep this line 
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. <?php //include this class 
  4.   require_once("myClass.php");
  5.  //create object of this class as 
  6. $crud = new CRUD();
  7. //now you can save data as in any Asian language like Urdu, Arabic etc i.e.
  8.     if($crud->insert("INSERT INTO myTbl(user_name,address) VALUES("شاہ حسین","محلہ چیل شگئی سیدو شریف سوات")){
  9.             echo('check your table in sqlyog or phpMyAdmin to see your urdu fonts has been saved in the table myTbl as it is in query');
  10.        }
  11.     else{
  12.             //internal server error
  13.        }
  14.  
  15. ?>
If still any problem let me know
Shah Hussain
shahhussain305@gmail.com

enjoy
Aug 3 '12 #9
Dormilich
8,658 Expert Mod 8TB
you know you’re about 5 years late on this?
Aug 4 '12 #10
:)) i did not see the date i just seen the question and try to help, may be some one else get help from this.
Lol:
Aug 4 '12 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: zahid | last post by:
Hello, Dear Friends, I have to make such type of interface,you can say it a html form. in which a admin can write arabic data and can insert that data or recordsin database in ASP. and i have to...
0
by: Garrek | last post by:
I have an existing ASP.Net application that must be modified to support mixed content: Latin-based languages (i.e. English) intermixed with Arabic. Our code and database assumes everything is...
6
by: Michelle Stone | last post by:
Hi I am doing a bilingual .NET application for English/Arabic. On a web form, I have some edit boxes for data entry in Arabic and some for entry in English. Right now the user has to change his...
1
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was...
1
by: Marcus | last post by:
Hello, I recently upgraded from 4.0 to 4.1. I've spent the last few days reading up on charsets since I never really thought about it when I used 4.0. I thought I had most of it figured out,...
4
by: ikp | last post by:
I have a mysql table which is populated with arabic data. I gave the charset as utf-8 and in phpmyadmin the values are shown in arabic. But when i query the db with a select statement and print the...
2
by: PrateekArora | last post by:
Hi Guys, I need to develop a MultiLingual Application (Arabic & English) in VB.NET, as far as Labels and captions are concerned in User Interface I am done with that using Resource Manager Class &...
0
taroo2ah
by: taroo2ah | last post by:
Hello everybody, Making backup of a MySQL database allways ruins the data inside it! I have tried many things and I am now againest something that I need to know: what is the deference between...
3
by: farukcse | last post by:
Dear Sir, i am facing a problem with encoding for arabic characters. here is the code: 1.test.html &lt;html&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; var AJAX = { initialize:...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.