Home arrow MySQL arrow Page 6 - Developing A Site Search Engine With PHP And MySQL
MYSQL

Developing A Site Search Engine With PHP And MySQL


The key to developing a successful web site is content. Sure, your site can be packed with 10,000 50-page articles, but what good are these articles if your visitors can't find what they're after? In this article Mitchell shows us how to create a site search engine with PHP and MySQL. He develops the MySQL database and PHP script that will allow us to enter several keywords to search dynamic content.

Author Info:
By: Mitchell Harper
Rating: 4 stars4 stars4 stars4 stars4 stars / 145
February 16, 2002
TABLE OF CONTENTS:
  1. · Developing A Site Search Engine With PHP And MySQL
  2. · Search Engine Theory
  3. · Creating the database
  4. · The searchdocs.php script
  5. · The doSearch function
  6. · Testing our search script
  7. · Conclusion

print this article
SEARCH DEVARTICLES

Developing A Site Search Engine With PHP And MySQL - Testing our search script
(Page 6 of 7 )

Here's the output from our searchdocs.php script when I entered "mysql" (without quotes) into the text field:

Search results for the mysql keyword

Let's add another record to our database and then conduct a search based on multiple keywords. Enter the following code at the MySQL command prompt:

insert into articles values(0, 'Apache is pronounced A-Patchy', 'Did you know that Apache is pronounced A-Patchy, because back in its early days it consisted of code that was just \'patched\' together roughly to create a web server?');

We need to tell the search script that the keyword "apache" is related to our new document, so enter the following MySQL command also:

insert into searchWords values(0, 'apache', 3);

Now, enter "mysql apache" as the search keywords in the text box and click the search button. You should see three articles returned (note that there are no duplicates returned):

Searching for the keywords mysql apache
blog comments powered by Disqus
MYSQL ARTICLES

- MySQL and BLOBs
- Two Lessons in ASP and MySQL
- Lord Of The Strings Part 2
- Lord Of The Strings Part 1
- Importing Data into MySQL with Navicat
- Building a Sustainable Web Site
- Creating An Online Photo Album with PHP and ...
- Creating An Online Photo Album with PHP and ...
- PhpED 3.2 More Features Than You Can Poke ...
- Creating An Online Photo Album with PHP and ...
- Creating An Online Photo Album with PHP and ...
- Security and Sessions in PHP
- Setup Your Personal Reminder System Using PHP
- Create a IP-Country Database Using PERL and ...
- Developing a Dynamic Document Search in PHP ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials