Sort output by relevance

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
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Sort output by relevance

Post by thiscatis »

I'm working on a script that searches in one table for products.
A product has different attributes, so different colums in the table in the database.
I'm using the OR statement in SQL to compare post data with the product colums in the database.
Is there a way to sort the results by matching columns?
So that a product with more matching colums from the query ranks higher than another..
Hope you understand what I mean :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You can use the ORDER BY clause for this.
Post Reply