Jump to content

Very simple question about searching


eyaleyal

Recommended Posts

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!  :)

Link to comment
https://forums.phpfreaks.com/topic/139507-very-simple-question-about-searching/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.