I am having nearly 80,000 records in a single table in MYSQL, I wanna make it display in the Autocomplete control.
The table structure is given below
Table_name
-ID
-Code
-codeType
In client side, I have made that autocomplete script like given below
var Cds = "";
$.ajax({
type: "POST",
url:"cdList.php",
async: false,
data:{
value1 : '9'
},
success:function(result){
Cds = JSON.parse(result);
}
});
$("#prin").autocomplete({
minlength : 3,
source: Cds,
autoFocus:true,
width:500
});
cdList.php
<?php
$con = mysql_connect("localhost","***","***");
if(!$con){
die("Error : ".mysql_error());
}
mysql_select_db("ananth",$con);
$value1 = $_POST['value1'];
$cd9 = array();
$result = mysql_query("select * from Table_name where codeType = '9' AND Code LIKE '$value1%'");
while($row = mysql_fetch_array($result)){
$cd9[] = $row['Code'];
}
echo json_encode($cd9);
?>
Even i set minLength in autocomplete control, still i am feeling damn slowness on getting the data. It took around 30 seconds. So what will be the work around to make it fast?