<?php include "header.php"; //$_GET['term'] $sql = "select `name` from " . $xoopsDB->prefix("phone_book") . " where `name` like '%{$_GET['term']}%'"; $result = $xoopsDB->queryF($sql); while(list($name) = $xoopsDB->fetchRow($result)){ $arr[]=$name; } echo json_encode($arr);