Solved

PHP Simple Search Script

Posted on 2012-03-09
2
288 Views
Last Modified: 2012-08-30
Hi Experts,

I'm in the middle of developing a website, I want a search page that searches through mysql database.

I have 3 text boxes, each of them to search through the database.

Is there any scripts available? I need a simple php mysql search script, if possible?

Any help appreciated. Thanks.

Regards,
0
Comment
Question by:Fezi
2 Comments
 
LVL 20

Accepted Solution

by:
virmaior earned 500 total points
Comment Utility
I doubt there's going to be a ready made script for that... but it's not a complex query depending on how many tables you want to search in the background. MySQL has two types of queries that are useful for searching a DB:

1) the LIKE operator --> WHERE column LIKE '%value%';
2) fulltext -> WHERE MATCH
('Content') AGAINST('+keyword1 +keyword2' IN
BOOLEAN MODE) HAVING Relevance > 0.2 ORDER
BY Relevance DESC  [see http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html ]

The advantage of the former is that all you have to do is plop your search terms in. The advantage of the latter is that it can be indexed so it does not kill your database in terms of speed.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
If your site can generate web pages that expose all of the data in response to a GET method request, you can create a "site map" page and then point one of the popular search engines at it (like Google Site Search).  I have used Freefind, Atomz, Picosearch and a personal favorite, Zoom from Wrensoft.  All have met my search needs adequately.  Since they spider asynchronously and store the results for quick lookup, you do not take a performance hit when people search the site.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now