Here is my code
<div>
<label for="dynamicSearch">Search:</label>
<input id="dynamicSearch">
</div>
$(function () {
// autocomplete
$("#dynamicSearch").autocomplete({
source: "dynamicSearch.php",
minLength: 1
});
});
dynamicSearch.php
<?php
$con = pg_connect("connection");
if (!$con)
{
die("Could not connect: " . pg_last_error());
}
$dynamicSearch = "SELECT name from bkash_dist WHERE name LIKE '%".$_GET['term']."%' LIMIT 10";
$result = pg_query($con, $dynamicSearch);
while($row = pg_fetch_array($result))
{
$results[] = array('label' => $row['distrbutor']);
}
pg_close($con);
$encoded = json_encode($results);
// send response back to index.html
// and end script execution
die($encoded)
?>
When I am searching with "A" its giving all result those contains "A" but I want those start with "A" or "a" (case sensitive). How can I do it?