Jump to content

Small search problem on my website


McMaster

Recommended Posts

Hey,

 

I am trying to create a search on my website but I am having a problem. When I type in "Delete Account" no results are shown even though there is results. If I narrow it down to just "Delete" results are shown. Is there any way I can make it search even if I type in Delete Account? This is my query:

 

mysql_query("SELECT * FROM help_topics WHERE topic LIKE '%$query%' OR text LIKE '%$query%'");

 

Thanks guys

Link to comment
https://forums.phpfreaks.com/topic/206768-small-search-problem-on-my-website/
Share on other sites

Yeah I see what you are saying premiso. I will have a further look in to it. This fulltext search though that was mentioned, I tried it with this query:

 

$sql = mysql_query("select * match(topic,text) against('$query') as relevance from help_topics");

if (mysql_num_rows($sql)) {

//code

}

 

And I am resulted in this error:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/juiceoff/public_html/search_help.php  on line 361

 

Any help there? I am not sure whether I can use mysql_num_rows with fulltext so hopefully someone can point me in the right direction here.

You may be interested in http://www.sphinxsearch.com/

 

But the full-text search only returns rows if the search terms return less than 50% of the rows in the table (if I am not mistaken). So for not very large tables the full text isn't the best tool to use.

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.