Jump to content

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

You just skimmed over it.  Read it a bit more in detail, such as how I exploded the items at the space and the made it search for the different terms combing them with an OR so it pulls items that have either DELETE or Account in them.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.