$query =mysql_query("select title from ( select title from {$dbtbpre}ecms_all where title like '%{$keyboard}%' union all select title from {$dbtbpre}ecms_mtv where title like '%{$keyboard}%' ) t order by LENGTH(title)-LENGTH(replace(title,'{$keyboard}','')) desc"); 我该城了mysql_query还是不行
function ajaxsearch($keyboard) { global $empire,$dbtbpre; if(strlen($keyboard) >0) { $query = $empire->query("select title from ( select title from {$dbtbpre}ecms_all where title like '%{$keyboard}%' union all select title from {$dbtbpre}ecms_mtv where title like '%{$keyboard}%' ) t order by LENGTH(title)-LENGTH(replace(title,'{$keyboard}','')) desc"); while($result=$empire->fetch($query)) { $info_list+="<div>{$result['title']}</div>"; }
select title from {$dbtbpre}ecms_all where title like '%{$keyboard}%'
union all
select title from {$dbtbpre}ecms_mtv where title like '%{$keyboard}%'
) t
order by LENGTH(title)-LENGTH(replace(title,'{$keyboard}','')) desc");
我该城了mysql_query还是不行
{
global $empire,$dbtbpre;
if(strlen($keyboard) >0) {
$query = $empire->query("select title from (
select title from {$dbtbpre}ecms_all where title like '%{$keyboard}%'
union all
select title from {$dbtbpre}ecms_mtv where title like '%{$keyboard}%'
) t
order by LENGTH(title)-LENGTH(replace(title,'{$keyboard}','')) desc");
while($result=$empire->fetch($query))
{
$info_list+="<div>{$result['title']}</div>";
}
}
echo $info_list;
}这个是完整的函数
改成
echo $result['title'];
不就知道是那里问题了吗?
这是基本的除错技巧
这样正常,但是为什么$info_list+=" <div>{$result['title']} </div>"; 不行