my query filtration wont filter names with letter(Ñ
) in there names....can anyone help me make my query read and filter names with letter(Ñ
) on it...please.
everytime theres an Ñ on there name my query will read it as a null.
current code:
<form>
<input type="text" name="search" id="query"/>
</form>
<script type="text/javascript">
$(document).ready(function(){
$("#query").autocomplete({
source : 'search.php',
select : function(event,ui){
$("#query").html(ui.item.value);
}
});
});
</script>
search.php code:
<?php
$q = $_GET['term'];
mysql_connect("localhost","root","");
mysql_select_db("klayton");
$query = mysql_query("SELECT name
FROM tb_applicants
WHERE name LIKE '$q%'");
$data = array();
while($row = mysql_fetch_array($query)){
$data[]=array('value'=>$row['name']);
}
echo json_encode($data);
?>
add this before you run your query;
mysql_query("SET NAMES utf8");
change the encoding and collation of your table and column to utf8
- utf8_general_ci
change your php like this to avoid sending empty values:
while($row = mysql_fetch_array($query)){
if(!empty($row['name']))
$data[]=array('value'=>$row['name']);
}