399rozanne290habbs685
New Member
I'm trying to use the jquery UI autocomplete widget to retrieve names out of a mysql table in a php file (nameSearch.php)It's not retrieving the results properly. Is there anything wrong with the Jquery I have here? Should it return results to the input with id 'tags'?I'm getting the '$_GET['term']' variable in the php file which I understand is sent from the autocomplete request to the php file?This is the Jquery code I have:\[code\]<script> $("#tags").autocomplete({ source: "nameSearch.php", minLength: 2 });</script>\[/code\]php\[code\] <?php $namePart=$_GET['term']; $names = array();// Create connection $con=mysqli_connect('localhost','root','admin','filmdatabase'); // Query Database $result = mysqli_query($con,"SELECT name FROM actor WHERE name like '%".$namePart."%'"); $arr = ''; while($row = mysqli_fetch_array($result)){ array_push($names,$row['name']); } echo json_encode($names);?>\[/code\]Thanks for your help