I'm making basic PHP & MySQL searching. Our country usually use character encoding which is utf-8 or euc-kr .
when I input the keyword that is English, the result is shown well. but, input the Korean keyword, the result doesn't shown on the screen. (result count doesn't shown) I'm coding on Eclipse PDT, every html,php document's encodings are EUC-KR. I set up property. and MySQL's table collation is euckr_korean. I don't know what to do. I'm newbie on php.
Code is simple. there are 2 document.
index.html
<body>
<form action="./search.php" method="get">
<label>
Search
<input type="text" name="keywords">
<input type="submit" value="Search">
</label>
</form>
</body>
search.php
<?php
$db = new mysqli('localhost', 'root', 'apmsetup', 'consen');
if(isset($_GET['keywords'])){
$keywords = $db->escape_string($_GET['keywords']);
$query = $db->query("
SELECT title
FROM data
WHERE title LIKE '%{$keywords}%'
");
?>
<div class="result-count">
Found <?php echo $query->num_rows; ?> results. </div>
<?php
}
?>
Database Table
text | code
삼성전자 | 005930
현대차 | 005380
LG | 003550
when I input 'LG (English) ' , the result's count is 1 (correctly shown)
How to solve this problem? I need your help... Thanks.