Jump to content

Trying to query some fulltext results with php from MySQL.


00stuff

Recommended Posts

Hi guys, i'm trying to search from a form and use php to display the results of the FullText Search from a MySQL database, but I don't get any results from the query. This is the query:  $query="SELECT * FROM tutorials WHERE MATCH(title, tags) AGAINST ('$searchform')";  I think the query is right but it doesn't give me any results.... Does anyone know what could be wrong? I think it might be something wrong with my table (database).

 

my table should have 5 columns: id, title, category, content, tags

 

The form should search throught the title and tags columns to see if it finds anything matching the $searchform , but I don't think it is doing it.

 

Can anyone help please?

Link to comment
Share on other sites

That didn't work. I got an error message. I don't think it's a problem with the code, because I copied it from another script that I had. I just changed the table name and the fields of course. How do I make sure the fields ("title,tags") are set to fulltext? I'm pretty sure that's the problem.

Link to comment
Share on other sites

Ok, I clicked on the T and it added the full text, but now I get this error on the page.

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/r/o/c/rochoa1/html/itsupport/database/page/index.php on line 142

 

Line 142:    while($rowS = mysql_fetch_array($RESULT))

Link to comment
Share on other sites

Hey guys, thank you very much for your help. I figured it out. I only had one entry in my database and when using FullText searches if the result takes up 50% or more it dosn't return anything. I just placed more entries and then it worked. Thanks.

Link to comment
Share on other sites

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.