Very simple question about searching
Posted: Mon Jan 05, 2009 4:41 am
Hello,
I have articles in my website. Each article has title and content. I also have a search page to search my articles. So currently whenever someone is searching I use the following query (PHP + MySQL):
($keywords = the search keywords)
SELECT * FROM articles WHERE title LIKE '%$keywords%' OR content LIKE '%$keywords%'
My question is how do I show first in the list (ORDER BY) results that has the keywords in the title and only after that results that has the keywords in the content?
Thanks!
I have articles in my website. Each article has title and content. I also have a search page to search my articles. So currently whenever someone is searching I use the following query (PHP + MySQL):
($keywords = the search keywords)
SELECT * FROM articles WHERE title LIKE '%$keywords%' OR content LIKE '%$keywords%'
My question is how do I show first in the list (ORDER BY) results that has the keywords in the title and only after that results that has the keywords in the content?
Thanks!