Porl123 Posted November 25, 2009 Share Posted November 25, 2009 I've just made a search form for a page on my site that gets all images with a name similar to the one entered with `filename` LIKE '%'.$_POST['name'].'%' and I was wondering is there a way to order the results of the query by the results that match the search criteria the most? So going from most matched to least? If that's possible could you talk me through it? Thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/182962-order-by-most-matched/ Share on other sites More sharing options...
fenway Posted November 25, 2009 Share Posted November 25, 2009 Define "most". Quote Link to comment https://forums.phpfreaks.com/topic/182962-order-by-most-matched/#findComment-965723 Share on other sites More sharing options...
Porl123 Posted November 25, 2009 Author Share Posted November 25, 2009 Most would be the results with the most amount of characters from the search criteria. Quote Link to comment https://forums.phpfreaks.com/topic/182962-order-by-most-matched/#findComment-965726 Share on other sites More sharing options...
fenway Posted November 25, 2009 Share Posted November 25, 2009 LIKE won't return anything useful... you'll have to count either in mysql or application code. Quote Link to comment https://forums.phpfreaks.com/topic/182962-order-by-most-matched/#findComment-965732 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.