Jump to content

Search Tags Only in a database!!!


npsari

Recommended Posts

Hi  :)

 

I created a database

 

Then I created a table with the following rows

 

Writer:

StoryTittle:

StoryBody:

Tags:

Writer Email:

 

I want users to search for keywords in the "Tags" row only

 

And when the kewords match

 

All the 5 details of the writer come up

 

Is there a straight forward code for this, can anybody show me the way

Link to comment
https://forums.phpfreaks.com/topic/40787-search-tags-only-in-a-database/
Share on other sites

I'd recommend Fulltext searching.  You'll need to create a fulltext index on the "tags" column.

 

Tutorial here: http://www.phpfreaks.com/tutorials/129/0.php

 

The SQL is something like this:

SELECT *, MATCH(tags) AGAINST ($search) AS score FROM stories_table WHERE MATCH(tags) AGAINST($search) ORDER BY score DESC

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.