Current location: Hot Scripts Forums » Programming Languages » PHP » multiple search items in a variable


multiple search items in a variable

Reply
  #1 (permalink)  
Old 03-15-06, 12:50 AM
hookup hookup is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
multiple search items in a variable

Let's say I have a search page with a single field on it labeled search. If I search for computer, wireless, I get all results that have either computer and/or wireless in them. If I want only the results that have computer and wireless in them what is the best way to fo this. Below is my mysql query

SELECT *
FROM resources
WHERE match (name, keywords ) against ('search*' in boolean mode)
ORDER BY resources.Name

The (search*) is the variable that is passed from the search page. in this case it would be computer+wireless
__________________
www.hookafamilyup.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-15-06, 02:26 AM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
You'll want to set up your search field to intepret some sort of syntax.

A: You wrap double-quotes around a search term to specify that you would like the search to include the entire phrase.

B: You expand your search query to include one word at a time OR the entire phrase, returning your results with a percentage match based on input.

Just use google or any SE for that matter as an example of how your search input should be specified.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-16-06, 12:38 PM
hookup hookup is offline
Newbie Coder
 
Join Date: Feb 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
thanks nekeno12, your second option was the one that worked for me
__________________
www.hookafamilyup.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
using variable variables with multiple variables for parts of the name harlock PHP 7 07-26-05 08:35 PM
Search database with multiple AND problem Bonzo PHP 8 07-14-05 03:09 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 07:02 AM
Declared Functions skipper23 PHP 4 12-17-03 11:06 AM
index page not showing up skipper23 PHP 3 12-15-03 02:10 PM


All times are GMT -5. The time now is 07:08 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.