Ajax garbled questions (similar to Baidu search page), online answers, heroes are free to help

Source: Internet
Author: User
Ajax garbled text (similar to Baidu search page), online answers, heroes are free to help & nbsp; how to solve this garbled text !!! I posted all my codes: & lt ;? Php // require ('Common. inc. php '); // require ('config. inc. php '); mysql_connect ajax garbled questions (similar to Baidu search page), online answers, heroes are free to help
How can this garbled code be solved !!! I posted all the code:
 // Require ('Common. inc. php ');
// Require ('config. inc. php ');
Mysql_connect ('localhost', 'root', '123 ');
Mysql_select_db ("hxy1__20100416 ");
Mysql_query ("set names gbk"); // prevents garbled characters during database interaction
Header ('content-Type: text/html; charset = gbk ');

$ QueryString = $ _ POST ['querystring'];

If (strlen ($ queryString)> 0 ){
$ SQL = "SELECT username FROM phpcms_member WHERE username LIKE '". $ queryString. "% 'limit ";
Echo $ SQL;
$ Query = mysql_query ($ SQL );
While ($ result = mysql_fetch_array ($ query ))
{
$ Value = $ result ['username'];
Echo' '. $ Value .'';
}

}
?>


Htm:




Ajax search
Script

Function lookup (inputString ){
If (inputString. length = 0 ){
// Hide the suggestion box.
$ ('# Suggestions'). hide ();
} Else {
$. Post ("rpc. php", {queryString: "" + inputString + ""}, function (data ){
If (data. length> 0 ){
$ ('# Suggestions'). show ();
('{Autosuggestionslist'{.html (data );
}
});
}
} // Lookup
Function fill (thisValue ){
$ ('# InputString'). val (thisValue );
SetTimeout ("$ ('# suggestions'). hide ();", 200 );
}
Script

Body {
Font-family: Helvetica;
Font-size: 11px;
Color: #000;
}
H3 {
Margin: 0px;
Padding: 0px;
}
. SuggestionsBox {
Position: relative;
Left: 30px;
Margin: 10px 0px 0px 0px;
Width: 200px;
Background-color: #212427;
-Moz-border-radius: 7px;
-Webkit-border-radius: 7px;
Border: 2px solid #000;
Color: # fff;
}
. SuggestionList {
Margin: 0px;
Padding: 0px;
}
. SuggestionList li {
Margin: 0px 0px 3px 0px;
Padding: 3px;
Cursor: pointer;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.