ive got working live search with ajax and php
JQUERY:
$("#search").keyup(function() {
var search_input = $(this).val();
var dataString = 'keyword='+ search_input;
if(search_input.length>1){
$.ajax({
type: "GET",
url: "include/search.php?diary_date",
data: dataString,
beforeSend: function() {
$('#loading').addClass('loading');
}, success: function(server_response) {
$('#searchresultdata').html(server_response).show();
$('span#faq_category_title').html(search_input);
}
});
}return false;
});
PHP:
$q = "SELECT id_user, f_name, l_name, postcode, email,telp FROM user
WHERE f_name LIKE '%$keyword%'
OR l_name LIKE '%$keyword%'
OR email LIKE '%$keyword%'
OR postcode LIKE '%$keyword%'";
i want the search result, search from the first letter not from the middle or last for example:
keyword = JO
Result i want =
* JOHN BECKS
* JONATHAN WILKO
* KATY JOANS
for a moment the system pick up not only first even middle & last words
* TONY NESJO
* BAJOZ ZACKS
%as*so if you emit the first%it would search likeJO*but in SQL itsJO%