我正在尝试捕获第二个术语以显示结果,因此textbox1具有自动完成功能,textbox2具有简单输入 - 这是自动完成并在1个术语上返回值的代码...
//connect to your database
$term = trim(strip_tags($_GET['term']));//retrieve the search term that autocomplete sends
$qstring = "SELECT description as value,id FROM test WHERE description LIKE '%".$term."%'";
$result = mysql_query($qstring);//query the database for entries containing the term
while ($row = mysql_fetch_array($result,MYSQL_ASSOC))//loop through the retrieved values
{
$row['value']=htmlentities(stripslashes($row['value']));
$row['id']=(int)$row['id'];
$row_set[] = $row;//build an array
}
echo json_encode($row_set);//format the array into json data
我需要这样的东西
$term = trim(strip_tags($_GET['term']));
$term2 = trim(strip_tags($_GET['term2']));
$qstring = "SELECT description as value, lastname, id FROM test
WHERE description LIKE '%".$term."%'" AND lastname LIKE '%".$term2."%'";
etc...
有人可以帮忙吗?