help me for implementing search functionality in website.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

help me for implementing search functionality in website.

Post by learnerabn »

Hi
I'm involved in developing a website for a e-shopping company.
i want to include a search functionality in the site.
search should not be like google search for web pages.
if the user enter a string it should search the database for the match with product name or manufacturer name from a single table(lengthy table).
it should match the misspelled words also.
i searched the net for this but i cant get the appropriate method can any one help me?
Thanks in advance.
heren
Forum Newbie
Posts: 4
Joined: Thu Nov 20, 2008 2:54 am

Re: help me for implementing search functionality in website

Post by heren »

hi,
you are taking the data's from the database right, then why can't u use %search_keyword% in the query for what all fields you are searching for ?

eg: select * from products where name like '%search_keyword%' or category like '%search_keyword%'
User avatar
omniuni
Forum Regular
Posts: 738
Joined: Tue Jul 15, 2008 10:50 pm
Location: Carolina, USA

Re: help me for implementing search functionality in website

Post by omniuni »

If you want to include results form multiple columns, you can combine them using the "union" operator.
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

Re: help me for implementing search functionality in website

Post by learnerabn »

First thanks for your reply heren and omniuni......
I have done those things already and got the results....
but i have to sort the results in the order "for example if the search key word have 3 strings then the result that matches all the 3 string first and then for two and at last for one"
and the another thing i have to match for misspelled words...
can you help me guys...
Post Reply