仿百度提示框的问题

WBOY
Release: 2016-06-23 14:12:08
Original
718 people have browsed it

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=GBK" /><title>仿百度搜索输入框提示JS代码</title><link href="css/jquery.autocomplete.css" type=text/css rel=stylesheet><script type="text/javascript" src="js/jquery.js"></script><script type="text/javascript" src="js/jquery.autocomplete.js"></script><script language="javascript">			$(document).ready(function() {			$("#keyword").autocomplete("getajaxtag.php",			{				delay:10,            	minChars:1,            	matchSubset:1,            	matchContains:1,            	cacheLength:10,            	onItemSelect:selectItem,            	onFindValue:findValue,            	formatItem:formatItem,            	autoFill:false        	}    		);			});			function findValue(li) {    			if( li == null ) return alert("No match!");				if( !!li.extra ) var sValue = li.extra[0];				else var sValue = li.selectValue;				}			function selectItem(li) { findValue(li);}			function formatItem(row) { return row[0];//return row[0] + " (id: " + row[1] + ")"//如果有其他参数调用row[1],对应输出格式Sparta|896			}			function lookupAjax(){			var oSuggest = $("#keyword")[0].autocompleter;			oSuggest.findValue();			return false;			}</script></head><body><div class="sidebarBlock" style="margin:0 auto; text-align:center;">  <h3>仿百度搜索输入框提示JS代码(基于jquery.autocomplete.js插件)</h3>  <form id="formkeyword" name="formkeyword" method="post" action="post.php">    <div class="sidebarSearch">          <input type="text" name="keyword" size="40" maxlength="255" value="" id="keyword" class="text"></input>          <input type="submit" value="搜索" class="button"></input>    </div>  </form></div></body></html>
Copy after login



回复讨论(解决方案)

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";}}}
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!