作者:Mr_ZERO0000000 | 来源:互联网 | 2023-05-17 11:59
Ihavebeenwrittingakeywordsearchscriptbasedonthistutorial:http:www.hackosis.com200711
I have been writting a keyword search script based on this tutorial: http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/
我一直在编写基于本教程的关键字搜索脚本:http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/
Like some of the commenters mentioned, the script only ends up returning results based on the last word in the search terms. So I have also tried to implement one of the suggestions from another user, but now I seem to only be able to get results based on the first search term.
与提到的一些评论者一样,脚本最终只会根据搜索字词中的最后一个字返回结果。所以我也试图实现其他用户的一个建议,但现在我似乎只能根据第一个搜索词得到结果。
The code for my script can be found here: http://php.pastebin.com/m7759afd3
我的脚本代码可以在这里找到:http://php.pastebin.com/m7759afd3
My print_r for the results looks like this:
我的print_r结果如下:
SELECT * FROM blog WHERE blog_title LIKE '%barry%' OR blog_content LIKE '%barry%' AND blog_title LIKE '%child%' OR blog_content LIKE '%child%' AND blog_title LIKE '%help%' OR blog_content LIKE '%help%' ORDER BY blog_title
SELECT * FROM links WHERE link_title LIKE '%barry%' OR link_desc LIKE '%barry%' AND link_title LIKE '%child%' OR link_desc LIKE '%child%' AND link_title LIKE '%help%' OR link_desc LIKE '%help%' ORDER BY link_title
SELECT * FROM pages WHERE page_title LIKE '%barry%' OR page_content LIKE '%barry%' AND page_title LIKE '%child%' OR page_content LIKE '%child%' AND page_title LIKE '%help%' OR page_content LIKE '%help%' ORDER BY page_title
Thank you for any help you might be able to offer.
感谢您提供的任何帮助。
2 个解决方案