当前位置:Gxlcms > PHP教程 > 仿百度提示框的问题

仿百度提示框的问题

时间:2021-07-01 10:21:17 帮助过:4人阅读

输入其它字符都能正常显示
就是输入00或000的时候就显示不了,数据库里面有相关的数据
我估计是不是把000当成空值了?请各位大神帮我看看

仿百度搜索输入框提示JS代码  

仿百度搜索输入框提示JS代码(基于jquery.autocomplete.js插件)




回复讨论(解决方案)

include_once ('conn.php');$keyword = $_GET ['q'] ;$sql = mysql_query ( "SELECT DISTINCT(item_code) FROM sku_rule WHERE  item_code LIKE '" . $keyword . "%'  LIMIT 0,10" );$myaf = mysql_affected_rows();while ( $value = mysql_fetch_array ( $sql ) ) {	echo $keyword = iconv ( 'utf-8', 'utf-8', $value ['item_code'] ) . "\n";}if($myaf<10){$li=10-$myaf;$sql_sku = mysql_query ( "SELECT DISTINCT(sku) FROM sku_rule WHERE  sku LIKE '" . $keyword . "%'  LIMIT 0,$li" );$myaf_sku = mysql_affected_rows();while ( $value_sku = mysql_fetch_array ( $sql_sku ) ) {	echo $keyword = iconv ( 'utf-8', 'utf-8', $value_sku ['sku'] ) . "\n";}$as=$myaf+$myaf_sku;if($as<10){$as=10-$as;$sql_as = mysql_query ( "SELECT DISTINCT(asin) FROM sku_rule WHERE  asin LIKE '" . $keyword . "%'  LIMIT 0,$as" );while ( $value_as = mysql_fetch_array ( $sql_as ) ) {	echo $keyword = iconv ( 'utf-8', 'utf-8', $value_as ['asin'] ) . "\n";}}}

人气教程排行