i am using an autocomplete with multiple, remote, and a search.php file that has mysql and php but i cannot get my the autocomplete to work here the search file.
Seach.php file
- <?php
- sleep( 3 );
// no term passed - just exit early with no response
if (empty($_GET['term'])) exit ;
$q = strtolower($_GET["term"]);
// remove slashes if they were magically added
if (get_magic_quotes_gpc()) $q = stripslashes($q);
- $query = "SELECT * FROM {$dbprefix}members WHERE disable = '0' ORDER BY username ASC";
$result = mysql_query($query)
or die(mysql_error());
while($row = mysql_fetch_array($result))
{
extract($row);
$username = textFilter($username);
$items .= "$username";
}
- $Members = array();
foreach ($items as $key=>$value) {
if (strpos(strtolower($key), $q) !== false) {
array_push($Members, array("id"=>$value, "label"=>$key, "value" => strip_tags($key)));
}
if (count($Members) > 11)
break;
}
- // json_encode is available in PHP 5.2 and above, or you can install a PECL module in earlier versions
echo json_encode($Members);
- ?>
where did i go wrong.
i think it has to do with the search file.