I want to limit search to Names using jqueryUi's auto-complete so that results returned are only Names and don't include other array values like fax and stuff.
Here's my php.
<?php
require_once 'db_conx.php';
$req = "SELECT * "
."FROM profiles "
."WHERE name LIKE '%".mysql_real_escape_string($_REQUEST['term']) ."%' ";
$query = mysql_query($req);
while($row = mysql_fetch_array($query))
{
$return = array ('label' => $row['name'],
'founder' => $row['founder'],
'fax' => $row['fax']
);
}
echo json_encode($return);
?>
Javascript
$(function() {
$( "#SearchInput").autocomplete({
source: '../Search/BP_Search.php',
minLength: 2,
autoFocus: false,
select: function(event, ui) {
$('#ProName' ).html(ui.item.name);
$('#ProFax' ).html(ui.item.fax);
$('#ProFounder' ).html(ui.item.founder);
}
});
Thanks.