I have a Thai language content in m MySQL Database with collation utf8_unicode_ci
i have used the following to display it correctly on my webpage
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<style type="text/css">
.thai {
font-family:Tahoma, Arial Unicode MS;
font-size: 2em;
</style>
</head>
<body>
<div id="content"><span class="thai"><?php echo $row['description2'];?></span></div>
my DB connection file has following code
mysqli_query($connection, "SET NAMES UTF8");
Now the PROBLEM is it displays correctly, BUT my SEARCH BOX can not search it if somebody tries searching in Thai language, but searches correctly with english content present in the database
following is my code for SEARCH
<form method="GET" action="index.php" accept-charset="UTF-8">
<input class="thai" type="text" charset="UTF-8" class="keyword" value="Search" name="search" id="q" onFocus="if(this.value==this.defaultValue) this.value='';" onBlur="if(this.value=='') this.value=this.defaultValue;" /><br />
</form>
<?php
require_once('inc/connect.php');
//NOT SURE IF THE FOLLOWING DECODING IS MAKING ANY SENSE, I still Get the -No result found- for thai language, but it made the boolean error go away
$search1=$_GET['search'];
$search=utf8_decode($search1);
$select1="SELECT * FROM products where id like '%$search%' || title like '%$search%' || size like '%$search%' ||description1 like '%$search%'|| description2 like '%$search%' order by id asc";
$result=mysqli_query($connection, $select1);
$num=mysqli_num_rows($result);
if($num > 0)
{
while($row=mysqli_fetch_array($result))
{
$oid=$row['id'];
echo $row['title'];
}
}
else{
$ertx="No Records Found In Database";
echo $ertx;
}
?>