Jump to content

autocomplate textfield can't read arabic letter


evilboy1151987

Recommended Posts

link to my site >  http://mwlobby.0fees.net/movement.php

when you write in customer name " ا " should be 3 value appear

but only see "???"

any help ?!

 

<?php
mysql_query("SET NAMES cp1256");
mysql_query("set characer set cp1256");

$conn = mysql_connect("****","****","***");
mysql_select_db("*****",$conn);

if(isset($_GET['getCountriesByLetters']) && isset($_GET['letters'])){
$letters = $_GET['letters'];
$letters = preg_replace("/[^a-z0-9 ]/si","",$letters); //  << i think error is here
$res = mysql_query("select customer_id,customer_name from customers where customer_name like '%".$letters."%'") or die(mysql_error());
while($inf = mysql_fetch_array($res)){
	echo $inf["customer_id"]."###".$inf["customer_name"]."|";
	$n = $_GET['cname'];
}	
}
?>

You might want to set up the following configuration:

 

1. MySQL charset: UTF-8 Unicode (utf8)

2. MySQL connection collation: utf8_general_ci

3. Your database and table collations are set to: utf8_general_ci or utf8_unicode_ci

 

Then, add this code in your php script when you connect to db:

 

mysql_query("SET NAMES 'utf8'");

mysql_query("SET CHARACTER SET utf8");

 

Not tested it, but I think it should work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.