时间:2021-07-01 10:21:17 帮助过:4人阅读
仿百度搜索输入框提示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";}}}