The drop-down prompt box for php + mysql + ajax implementation of Baidu search mainly contains three files and three files in the same directory. below is the code for the three files. import the SQL file to the mysql database and modify it. under the database password for their own remember Oh UTF-8 code Ajax
The drop-down prompt box for php + mysql + ajax implementation of Baidu search mainly contains three files and three files in the same directory, as shown in figure
The following is the code of the three files to import the SQL file into the mysql database to modify the database password for their own remember Oh is UTF-8 code
Php + mysql + ajax implement Baidu search drop-down prompt box
Rpc. php file
The code is as follows:
Mysql_connect ('localhost', 'root ','');
Mysql_select_db ("test ");
$ QueryString = $ _ POST ['querystring'];
If (strlen ($ queryString)> 0 ){
$ SQL = "SELECT value FROM countries WHERE value LIKE '". $ queryString. "% 'limit 10 ";
$ Query = mysql_query ($ SQL );
While ($ result = mysql_fetch_array ($ query, MYSQL_BOTH )){
$ Value = $ result ['value'];
Echo'
'. $ Value .'';
}
}
?>
Index.htm file
The code is as follows:
Ajax Auto Suggest