我有一个带有 5 个下拉菜单的基本搜索表单,我希望它搜索 2 个数据库内容并将其显示在结果页面中。我以前没有这样做过,互联网上几乎没有任何东西可以指导我。我正在寻找一个结果.php页面。数据库名称是旅游和出发。游览表:代码、运算符、持续时间、概述、图像、tour_style出发表:代码、运营商、start_date、end_date、价格、状态非常感谢所有帮助
我已经使用php和mysql(用于单一数据库)为我的网站制作了一个搜索表单。 我在mysql命令语法中使用了MATCH和AGAINST 。这些是一些有用的链接,可以帮助您制作搜索表单。
http://devzone.zend.com/26/using-mysql-full-text-searching/#Heading12
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
http://forums.digitalpoint.com/showthread.php?t=27529
http://www.seopher.com/articles/tutorial_mysql_fulltext_searching
例如:
SELECT *
FROM tours
WHERE MATCH ( code,operator,duration, overview, image, tour_style )
AGAINST ( '%$keywords%' );
我只对一个数据库尝试过这个,它对我来说非常有效。我不确定是否为两个数据库创建搜索表单。也许您可以创建两个 mysql Match 查询,一个用于旅行,另一个用于出发,就像这样。
SELECT *
FROM tours
WHERE MATCH ( code,operator,duration, overview, image, tour_style )
AGAINST ( '%$keywords%' );
SELECT *
FROM departures
WHERE MATCH ( code, operator, start_date, end_date, pricecode, operator, start_date, end_date, price )
AGAINST ( '%$keywords%' );
请彻底搜索谷歌..
免责声明:没有在机器中尝试过上面的MySQL代码,因为我没有安装mysql在这台机器上