MortimerJazz Posted February 27, 2007 Share Posted February 27, 2007 That's not a very descriptive title, so let me try and explain what I want to do. Basically, when a user searches through the database, I don't want the results page to show up blank if nothing matches the criteria which the user has inputted. Therefore if the database doesn't find an exact match, it would be nice if it brought up records which were similar to what the user wants. So let's say someone's looking for a car and wants a 4 Door Red Audi. Nothing like that is in the database, but I'd like my script to effectively say "We don't have that, but we do have a 4 Door Blue Audi" Can anyone suggest the best way of doing this please? Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/ Share on other sites More sharing options...
fenway Posted February 27, 2007 Share Posted February 27, 2007 The standard game of fuzzy matching... depends how you store the info, and how easy it is to search. Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/#findComment-195362 Share on other sites More sharing options...
MortimerJazz Posted February 27, 2007 Author Share Posted February 27, 2007 Hi Fenway, Thanks for the reply. Most of the content is stored in VARCHAR fields or short text fields. Stuff like the number of doors is stored in NUMBER fields and any features like (leather seats, 4WD to keep the example above going) is recorded by a "TRUE" in the relevant field name. Does that help at all? Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/#findComment-195432 Share on other sites More sharing options...
fenway Posted February 27, 2007 Share Posted February 27, 2007 There are kludgy ways to do it, combining overlapping search results, etc... Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/#findComment-195457 Share on other sites More sharing options...
MortimerJazz Posted April 8, 2007 Author Share Posted April 8, 2007 Could you give me a simple example at all fenway? Thanks a lot for your help ... Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/#findComment-224052 Share on other sites More sharing options...
fenway Posted April 8, 2007 Share Posted April 8, 2007 Well, if you can search for each piece individual, you can come up with a list of "nearby" choices. Quote Link to comment https://forums.phpfreaks.com/topic/40330-command-to-search-for-something-similar/#findComment-224432 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.