Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Problem with MySQL search script
Old 08-22-2007, 12:57 PM Problem with MySQL search script
Average Talker

Posts: 23
Trades: 0
I have a form with one input where people can type in search terms. It then takes them to a script where it assigns a value to the search term and then runs it against a mysql product database. The problem is I would like to break the users search query into individual words for better search results. I have tried using explode() and it wont work. I have no idea why, this is the select statement I am using now including all the fields which need to be searched. Can you see any problems with it, maybe the problem isnt with the explode function but with my statement? If not, is there a simple alternative way to doing a search against a mysql db and breaking up a query into individual keywords? Thank you for the help.

Code:
$rs = mysql_query("SELECT * FROM inventory WHERE condition = 'used' AND make LIKE '%" . $keywords . "%' OR type LIKE '%" . $keywords . "%' OR item_number LIKE '%" . $keywords . "%' OR year LIKE '%" . $keywords . "%' OR size LIKE '%" . $keywords . "%' OR finish LIKE '%" . $keywords . "%' OR model LIKE '%" . $keywords . "%' OR serial_number LIKE '%" . $keywords . "%' OR price LIKE '%" . $keywords . "%' OR information LIKE '%" . $keywords . "%' OR description LIKE '%" . $keywords . "%'");
mattgoldman is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-22-2007, 02:28 PM Re: Problem with MySQL search script
Novice Talker

Posts: 6
Name: !!cuisinart
Trades: 0
Checkout following mysql function.
Code:
 MATCH (col1,col2,...) AGAINST (expr [IN BOOLEAN MODE | WITH QUERY EXPANSION])
__________________

Please login or register to view this content. Registration is FREE
!!cuisinart is offline
Reply With Quote
View Public Profile Visit !!cuisinart's homepage!
 
Reply     « Reply to Problem with MySQL search script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.71817 seconds with 12 queries