0, 'message' => '', 'content' => ''); if(!$word_com || strlen($word_com) < 2 || strlen($word_com) > 30) { $result_com['error'] = 1; die($json_com->encode($result_com)); } $needle = $replace = array(); $word_com = str_replace(array(' ','*', "\'"), array('%', '%', ''), $word_com); $needle[] = $word_com; $replace[] = ''.$word_com.''; $logdb = array(); if(preg_match("/^[a-z0-9A-Z]+$/", $word_com)) { $sql_qq = "SELECT * FROM " . $ecs->table('keyword') ." WHERE searchengine='ecshop' AND status='1' AND letter LIKE '%$word_com%' ORDER BY total_search DESC"; } else { $sql_qq = "SELECT * FROM " . $ecs->table('keyword') ." WHERE searchengine='ecshop' AND status='1' AND word LIKE '%$word_com%' ORDER BY total_search DESC"; } $res_www_68ecshop_com = $db->SelectLimit($sql_qq, 10, 0); $iii=1; while ($rows_www_68ecshop_com = $db->fetchRow($res_www_68ecshop_com)) { $rows_www_68ecshop_com['kword'] = str_ireplace($needle, $replace, $rows_www_68ecshop_com['word']); /* start */ if($iii==1 && $rows_www_68ecshop_com['keyword_cat_count']) { $rows_www_68ecshop_com['keyword_cat'] = ''. $rows_www_68ecshop_com['keyword_cat'] .'分类中搜索'; $rows_www_68ecshop_com['keyword_cat_count'] = intval($rows_www_68ecshop_com['keyword_cat_count']); } $iii=$iii+1; /* end */ $logdb[] = $rows_www_68ecshop_com; } $smarty->assign('logdb', $logdb); $result_com['content'] = $smarty->fetch('library/search_tip.lbi'); die($json_com->encode($result_com)); } ?>