i'm trying autocomplete working website i'm building company, can't seem jquery function execute. website build on top of wordpress.
the input line:
<strong>customer: </strong> <input type='text' name='cust' id='cust'> the autocomplete:
<script type='text/javascript'> jquery('#cust').autocomplete({ source : "scripts/cust_search.php", minlength:1 }); and cust_search.php:
<? $term = trim(strip_tags($_get[ "term" ])); $a_json = array (); $a_json_row = array (); if ($companies = $panther->get_results("select cust_id, cust_name customer '%$term%' order cust_name asc;")) { while ($row = mysqli_fetch_array($companies)) { $a_json_row ["id"]=$panther->escape($row['cust_id']); $a_json_row ["value"]=$panther->escape($row['cust_name']); $a_json_row ["label"]=$panther->escape($row['cust_name']); array_push($a_json, $a_json_row); } } echo json_encode( $a_json ); ?>
the problem seems sql query. missing statement
try
"select cust_id, cust_name customer **cust_name** '%$term%' order cust_name asc;" instead:
"select cust_id, cust_name customer '%$term%' order cust_name asc;"
Comments
Post a Comment