Php + ajax implement google search function 2 [original]

Source: Internet
Author: User

//

Original Works

Original Site: www.111cn.cn

Author: Noodle love rabbit QQ: 271728967

Note: Reprint please explain the original out of http://www.111cn.cn

//
Now let's talk about the post. php file. The post. php file is very simple. It may not be used in php many times, as long as it can be completed at the server foot. {personal opinion}

Header ("Content-type: text/html; charset = gb2312"); set the document encoding.

$ Key = isset ($ _ POST ['key'])? $ _ POST ['key']: '';
$ SQL = "select title from test where title like '% $ key %' order by title desc ";
$ Result = mysql_query ($ SQL) or die (mysql_error ());
Echo "<div id = show> ";
While ($ rs = mysql_fetch_array ($ result )){
Echo "<li onMouseOver = \" this. style. background = '# d7ebff' \ "onMouseOut = \" this. style. background = '# ffff' \ "onclick = \" javascript: fillin (this. innerHTML); \ "> ". $ rs ['title']. "</li> ";
}
Echo "</div> ";

Php + ajax implement google search function 2 [original].

Http://www.111cn.cn/test/test.html address:

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.