Hi All,
I've hit a brick wall trying to get the jquery autocomplete to work correctly. The problem is with the .php file and the way the While loop works, as what it does is create a array for every name rather than one single array. I've tried to move the 'echo json_encode' outside of the loop but then it only returns the very last value.
So question is how do I make the While function build an array of every distinct name in the database then echo as json_encode.
Thanks
CODE:
<?php
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Admin.mdb");
$queryString = $_GET['term'];
$query = "SELECT DISTINCT [PersonNameFirst] FROM Person WHERE PersonNameFirst like '$queryString%'";
$result = $conn->Execute($query);
while (!$result->EOF)
{
$fz = $result->Fields("PersonNameFirst");
$array = array($fz->value);
$result->MoveNext();
$output = $array;
echo json_encode($output);
}
?>